old-java-games

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 4d5ef9ac6d77453615a8195b704556d01af2af4a
Author: mpizzzle <michael.770211@gmail.com>
Date:   Tue, 26 Feb 2019 10:14:41 -0600

initial commit

Diffstat:
A.gitignore | 11+++++++++++
ACaveGame.html | 8++++++++
ACaveGame/1ST ROOM.gif | 0
ACaveGame/AlbumArtSmall.jpg | 0
ACaveGame/AlbumArt_{5A46157A-FA0D-4BB0-A4D7-98AC60E53D2A}_Large.jpg | 0
ACaveGame/AlbumArt_{5A46157A-FA0D-4BB0-A4D7-98AC60E53D2A}_Small.jpg | 0
ACaveGame/Bridge.java | 36++++++++++++++++++++++++++++++++++++
ACaveGame/Cave2.java | 36++++++++++++++++++++++++++++++++++++
ACaveGame/CaveArea.java | 107+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ACaveGame/CaveFrame.java | 11+++++++++++
ACaveGame/CaveGame.java | 86+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ACaveGame/CaveInterface.java | 11+++++++++++
ACaveGame/Cavern.java | 33+++++++++++++++++++++++++++++++++
ACaveGame/FirstCave.java | 36++++++++++++++++++++++++++++++++++++
ACaveGame/FirstRoom.java | 33+++++++++++++++++++++++++++++++++
ACaveGame/Folder.jpg | 0
ACaveGame/GAME COMPLETE.gif | 0
ACaveGame/GAMER PICKS A.gif | 0
ACaveGame/GAMER PICKS B THEN A.gif | 0
ACaveGame/GAMER PICKS B THEN B THEN A THEN B.gif | 0
ACaveGame/GAMER PICKS B THEN B THEN A.gif | 0
ACaveGame/GAMER PICKS B THEN B THEN B.gif | 0
ACaveGame/GAMER PICKS B THEN B THEN C.gif | 0
ACaveGame/GAMER PICKS B THEN B.gif | 0
ACaveGame/GAMER PICKS B.gif | 0
ACaveGame/GAMER PICKS C.gif | 0
ACaveGame/Gamer picks b) then b) then a) then a) then a).gif | 0
ACaveGame/Gamer picks b) then b) then a) then a) then b).gif | 0
ACaveGame/Gamer picks b) then b) then a) then a).gif | 0
ACaveGame/Hole.java | 36++++++++++++++++++++++++++++++++++++
ACaveGame/HotRoom.java | 34++++++++++++++++++++++++++++++++++
ACaveGame/LeftDoor.java | 36++++++++++++++++++++++++++++++++++++
ACaveGame/River.java | 34++++++++++++++++++++++++++++++++++
ACaveGame/Rope.java | 36++++++++++++++++++++++++++++++++++++
ACaveGame/WayOut.java | 36++++++++++++++++++++++++++++++++++++
ACaveGame/desktop.ini | 0
AEaster/Easter/Easter.java | 112+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ALink.html | 8++++++++
ALink/LinkArea.java | 145+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ALink/LinkFrame.java | 11+++++++++++
ALink/LinkGame.java | 544+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ALink/bigboss1.1.gif | 0
ALink/bigboss1.2.gif | 0
ALink/bigboss1.3.gif | 0
ALink/blob.gif | 0
ALink/bluegem.gif | 0
ALink/boss1.1.gif | 0
ALink/boss1.2.gif | 0
ALink/boss1.3.gif | 0
ALink/gemstand(with gems).gif | 0
ALink/gemstand(without gems).gif | 0
ALink/goldskullata.gif | 0
ALink/greengem.gif | 0
ALink/link atack left.gif | 0
ALink/link atack left2.gif | 0
ALink/link atack right.gif | 0
ALink/link atack right2.gif | 0
ALink/link jump left.gif | 0
ALink/link jump right.gif | 0
ALink/link shield left2.gif | 0
ALink/link shield right2.gif | 0
ALink/link slash left 1.gif | 0
ALink/link slash left2.gif | 0
ALink/link slash left3.gif | 0
ALink/link slash left4.gif | 0
ALink/link slash left5.gif | 0
ALink/link slash right 1.gif | 0
ALink/link slash right2.gif | 0
ALink/link slash right3.gif | 0
ALink/link slash right4.gif | 0
ALink/link slash right5.gif | 0
ALink/link.ico | 0
ALink/linkcrouchright.gif | 0
ALink/linkshieldleft.gif | 0
ALink/linkshieldleft2.gif | 0
ALink/linkshieldright.gif | 0
ALink/linkshieldright2.gif | 0
ALink/linkstandleft.gif | 0
ALink/linkstandleft2.gif | 0
ALink/linkstandright.gif | 0
ALink/linkstandright2.gif | 0
ALink/linksworddown.gif | 0
ALink/linkswordleft.gif | 0
ALink/linkswordleft2.gif | 0
ALink/linkswordright.gif | 0
ALink/linkswordright2.gif | 0
ALink/madblob.gif | 0
ALink/metor.gif | 0
ALink/octo.gif | 0
ALink/octopellets.gif | 0
ALink/princess Zelda.gif | 0
ALink/redgem.gif | 0
ALink/rock.gif | 0
ALink/spider.gif | 0
ALink/yellowgem.gif | 0
AMario.html | 8++++++++
AMario/Mario/1up!mushroom.gif | 0
AMario/Mario/Atomic Atom1.gif | 0
AMario/Mario/Atomic Atom2.gif | 0
AMario/Mario/Banzai Bill big.gif | 0
AMario/Mario/Banzai Bill small.gif | 0
AMario/Mario/Banzai Bill.gif | 0
AMario/Mario/Bowserstandleft.gif | 0
AMario/Mario/Bowserstandright.gif | 0
AMario/Mario/Bowserswalkleft2.gif | 0
AMario/Mario/Bowserswalkright2.gif | 0
AMario/Mario/Bowserwalkleft1.gif | 0
AMario/Mario/Bowserwalkright1.gif | 0
AMario/Mario/Bullet Bill.gif | 0
AMario/Mario/Chain Chomp Dead!!!.gif | 0
AMario/Mario/Chain Chomp!!!.gif | 0
AMario/Mario/Chain Chomp2!!!.gif | 0
AMario/Mario/Deadsnowman.gif | 0
AMario/Mario/Mario/1up!mushroom.gif | 0
AMario/Mario/Mario/Atomic Atom1.gif | 0
AMario/Mario/Mario/Atomic Atom2.gif | 0
AMario/Mario/Mario/Banzai Bill big.gif | 0
AMario/Mario/Mario/Banzai Bill small.gif | 0
AMario/Mario/Mario/Banzai Bill.gif | 0
AMario/Mario/Mario/Bowserstandleft.gif | 0
AMario/Mario/Mario/Bowserstandright.gif | 0
AMario/Mario/Mario/Bowserswalkleft2.gif | 0
AMario/Mario/Mario/Bowserswalkright2.gif | 0
AMario/Mario/Mario/Bowserwalkleft1.gif | 0
AMario/Mario/Mario/Bowserwalkright1.gif | 0
AMario/Mario/Mario/Bullet Bill.gif | 0
AMario/Mario/Mario/Chain Chomp Dead!!!.gif | 0
AMario/Mario/Mario/Chain Chomp!!!.gif | 0
AMario/Mario/Mario/Chain Chomp2!!!.gif | 0
AMario/Mario/Mario/Deadsnowman.gif | 0
AMario/Mario/Mario/Robot.gif | 0
AMario/Mario/Mario/Snowman.gif | 0
AMario/Mario/Mario/Wigler1.5Left.gif | 0
AMario/Mario/Mario/Wigler1.5Right.gif | 0
AMario/Mario/Mario/Wigler1Left.gif | 0
AMario/Mario/Mario/Wigler1Right.gif | 0
AMario/Mario/Mario/Wigler2Left.gif | 0
AMario/Mario/Mario/Wigler2Right.gif | 0
AMario/Mario/Mario/bobomb.gif | 0
AMario/Mario/Mario/bobomb2.gif | 0
AMario/Mario/Mario/bobombbang1.gif | 0
AMario/Mario/Mario/bobombbang2.gif | 0
AMario/Mario/Mario/bobombf2.gif | 0
AMario/Mario/Mario/bobombr.gif | 0
AMario/Mario/Mario/boo1.gif | 0
AMario/Mario/Mario/boo2.gif | 0
AMario/Mario/Mario/cannon.gif | 0
AMario/Mario/Mario/cool cube.gif | 0
AMario/Mario/Mario/cube.gif | 0
AMario/Mario/Mario/fireboo1.gif | 0
AMario/Mario/Mario/fireboo2.gif | 0
AMario/Mario/Mario/goomba.gif | 0
AMario/Mario/Mario/goomba2.gif | 0
AMario/Mario/Mario/goombaleft.gif | 0
AMario/Mario/Mario/goombaleft2.gif | 0
AMario/Mario/Mario/goombasquished.gif | 0
AMario/Mario/Mario/koopaparatroopa1.gif | 0
AMario/Mario/Mario/koopaparatroopa1left.gif | 0
AMario/Mario/Mario/koopaparatroopa2.gif | 0
AMario/Mario/Mario/koopaparatroopa2left.gif | 0
AMario/Mario/Mario/koopaparatroopashell.gif | 0
AMario/Mario/Mario/koopatroopa.gif | 0
AMario/Mario/Mario/koopatroopaleft.gif | 0
AMario/Mario/Mario/koopatroopashell.gif | 0
AMario/Mario/Mario/luigi1.gif | 0
AMario/Mario/Mario/luigi1left.gif | 0
AMario/Mario/Mario/luigi2.gif | 0
AMario/Mario/Mario/luigi2left.gif | 0
AMario/Mario/Mario/luigicrouch.gif | 0
AMario/Mario/Mario/luigicrouchleft.gif | 0
AMario/Mario/Mario/luigijump.gif | 0
AMario/Mario/Mario/luigijumpleft.gif | 0
AMario/Mario/Mario/luigistand.gif | 0
AMario/Mario/Mario/luigistandleft.gif | 0
AMario/Mario/Mario/mario.ico | 0
AMario/Mario/Mario/mario1.gif | 0
AMario/Mario/Mario/mario1left.gif | 0
AMario/Mario/Mario/mario2.gif | 0
AMario/Mario/Mario/mario2left.gif | 0
AMario/Mario/Mario/marioblo.gif | 0
AMario/Mario/Mario/marioblock.gif | 0
AMario/Mario/Mario/mariobox.gif | 0
AMario/Mario/Mario/mariocoin1.gif | 0
AMario/Mario/Mario/mariocoin2.gif | 0
AMario/Mario/Mario/mariocoin3.gif | 0
AMario/Mario/Mario/mariocrouch.gif | 0
AMario/Mario/Mario/mariocrouchleft.gif | 0
AMario/Mario/Mario/mariodead.gif | 0
AMario/Mario/Mario/mariofloor.gif | 0
AMario/Mario/Mario/mariofloor10.gif | 0
AMario/Mario/Mario/mariofloor2.gif | 0
AMario/Mario/Mario/mariofloor3.gif | 0
AMario/Mario/Mario/mariofloor4.gif | 0
AMario/Mario/Mario/mariofloor5.gif | 0
AMario/Mario/Mario/mariofloor6.gif | 0
AMario/Mario/Mario/mariofloor7.gif | 0
AMario/Mario/Mario/mariofloor8.gif | 0
AMario/Mario/Mario/mariofloor9.gif | 0
AMario/Mario/Mario/mariograss.gif | 0
AMario/Mario/Mario/marioicon.gif | 0
AMario/Mario/Mario/mariojump.gif | 0
AMario/Mario/Mario/mariojumpleft.gif | 0
AMario/Mario/Mario/mariometalbox.gif | 0
AMario/Mario/Mario/mariopipe.gif | 0
AMario/Mario/Mario/mariopipe2.gif | 0
AMario/Mario/Mario/mariostand.gif | 0
AMario/Mario/Mario/mariostandleft.gif | 0
AMario/Mario/Mario/mariotitle.gif | 0
AMario/Mario/Mario/mariowarp.gif | 0
AMario/Mario/Mario/missioncomplete.gif | 0
AMario/Mario/Mario/piranhaflying1.gif | 0
AMario/Mario/Mario/piranhaflying2.gif | 0
AMario/Mario/Mario/piranhaplant1.gif | 0
AMario/Mario/Mario/piranhaplant1huge.gif | 0
AMario/Mario/Mario/piranhaplant2.gif | 0
AMario/Mario/Mario/piranhaplant2huge.gif | 0
AMario/Mario/Mario/piranhaplantboss.gif | 0
AMario/Mario/Mario/piranhaplantboss2.gif | 0
AMario/Mario/Mario/piranhaplantbossA.gif | 0
AMario/Mario/Mario/piranhaplantbossB.gif | 0
AMario/Mario/Mario/piranhaplantbossC.gif | 0
AMario/Mario/Mario/piranhaplantbossD.gif | 0
AMario/Mario/Mario/piranhaplantbossE.gif | 0
AMario/Mario/Mario/piranhaplantbossf.gif | 0
AMario/Mario/Mario/piranhaplanthugepeep.gif | 0
AMario/Mario/Mario/piranhaplanthugepeepo.gif | 0
AMario/Mario/Mario/piranhaplanthugepeepy.gif | 0
AMario/Mario/Mario/piranharightflying1.gif | 0
AMario/Mario/Mario/piranharightflying2.gif | 0
AMario/Mario/Mario/poisonmushroom.gif | 0
AMario/Mario/Mario/supaturtle.gif | 0
AMario/Mario/Mario/super cannon.gif | 0
AMario/Mario/Mario/warship1.gif | 0
AMario/Mario/Mario/warship2.gif | 0
AMario/Mario/Mario/yes.bmp | 0
AMario/Mario/Mario/yetileft1.gif | 0
AMario/Mario/Mario/yetileft2.gif | 0
AMario/Mario/Mario/yetiright1.gif | 0
AMario/Mario/Mario/yetiright2.gif | 0
AMario/Mario/MarioArea.java | 306+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AMario/Mario/MarioFrame.java | 11+++++++++++
AMario/Mario/MarioGame.java | 1518+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AMario/Mario/Robot.gif | 0
AMario/Mario/Snowman.gif | 0
AMario/Mario/Wigler1.5Left.gif | 0
AMario/Mario/Wigler1.5Right.gif | 0
AMario/Mario/Wigler1Left.gif | 0
AMario/Mario/Wigler1Right.gif | 0
AMario/Mario/Wigler2Left.gif | 0
AMario/Mario/Wigler2Right.gif | 0
AMario/Mario/bobomb.gif | 0
AMario/Mario/bobomb2.gif | 0
AMario/Mario/bobombbang1.gif | 0
AMario/Mario/bobombbang2.gif | 0
AMario/Mario/bobombf2.gif | 0
AMario/Mario/bobombr.gif | 0
AMario/Mario/boo1.gif | 0
AMario/Mario/boo2.gif | 0
AMario/Mario/cannon.gif | 0
AMario/Mario/cool cube.gif | 0
AMario/Mario/cube.gif | 0
AMario/Mario/fireboo1.gif | 0
AMario/Mario/fireboo2.gif | 0
AMario/Mario/goomba.gif | 0
AMario/Mario/goomba2.gif | 0
AMario/Mario/goombaleft.gif | 0
AMario/Mario/goombaleft2.gif | 0
AMario/Mario/goombasquished.gif | 0
AMario/Mario/java.policy.applet | 7+++++++
AMario/Mario/koopaparatroopa1.gif | 0
AMario/Mario/koopaparatroopa1left.gif | 0
AMario/Mario/koopaparatroopa2.gif | 0
AMario/Mario/koopaparatroopa2left.gif | 0
AMario/Mario/koopaparatroopashell.gif | 0
AMario/Mario/koopatroopa.gif | 0
AMario/Mario/koopatroopaleft.gif | 0
AMario/Mario/koopatroopashell.gif | 0
AMario/Mario/luigi1.gif | 0
AMario/Mario/luigi1left.gif | 0
AMario/Mario/luigi2.gif | 0
AMario/Mario/luigi2left.gif | 0
AMario/Mario/luigicrouch.gif | 0
AMario/Mario/luigicrouchleft.gif | 0
AMario/Mario/luigijump.gif | 0
AMario/Mario/luigijumpleft.gif | 0
AMario/Mario/luigistand.gif | 0
AMario/Mario/luigistandleft.gif | 0
AMario/Mario/mario.ico | 0
AMario/Mario/mario1.gif | 0
AMario/Mario/mario1left.gif | 0
AMario/Mario/mario2.gif | 0
AMario/Mario/mario2left.gif | 0
AMario/Mario/marioblo.gif | 0
AMario/Mario/marioblock.gif | 0
AMario/Mario/mariobox.gif | 0
AMario/Mario/mariocoin1.gif | 0
AMario/Mario/mariocoin2.gif | 0
AMario/Mario/mariocoin3.gif | 0
AMario/Mario/mariocrouch.gif | 0
AMario/Mario/mariocrouchleft.gif | 0
AMario/Mario/mariodead.gif | 0
AMario/Mario/mariofloor.gif | 0
AMario/Mario/mariofloor10.gif | 0
AMario/Mario/mariofloor2.gif | 0
AMario/Mario/mariofloor3.gif | 0
AMario/Mario/mariofloor4.gif | 0
AMario/Mario/mariofloor5.gif | 0
AMario/Mario/mariofloor6.gif | 0
AMario/Mario/mariofloor7.gif | 0
AMario/Mario/mariofloor8.gif | 0
AMario/Mario/mariofloor9.gif | 0
AMario/Mario/mariograss.gif | 0
AMario/Mario/marioicon.gif | 0
AMario/Mario/mariojump.gif | 0
AMario/Mario/mariojumpleft.gif | 0
AMario/Mario/mariometalbox.gif | 0
AMario/Mario/mariopipe.gif | 0
AMario/Mario/mariopipe2.gif | 0
AMario/Mario/mariostand.gif | 0
AMario/Mario/mariostandleft.gif | 0
AMario/Mario/mariotitle.gif | 0
AMario/Mario/mariowarp.gif | 0
AMario/Mario/missioncomplete.gif | 0
AMario/Mario/piranhaflying1.gif | 0
AMario/Mario/piranhaflying2.gif | 0
AMario/Mario/piranhaplant1.gif | 0
AMario/Mario/piranhaplant1huge.gif | 0
AMario/Mario/piranhaplant2.gif | 0
AMario/Mario/piranhaplant2huge.gif | 0
AMario/Mario/piranhaplantboss.gif | 0
AMario/Mario/piranhaplantboss2.gif | 0
AMario/Mario/piranhaplantbossA.gif | 0
AMario/Mario/piranhaplantbossB.gif | 0
AMario/Mario/piranhaplantbossC.gif | 0
AMario/Mario/piranhaplantbossD.gif | 0
AMario/Mario/piranhaplantbossE.gif | 0
AMario/Mario/piranhaplantbossf.gif | 0
AMario/Mario/piranhaplanthugepeep.gif | 0
AMario/Mario/piranhaplanthugepeepo.gif | 0
AMario/Mario/piranhaplanthugepeepy.gif | 0
AMario/Mario/piranharightflying1.gif | 0
AMario/Mario/piranharightflying2.gif | 0
AMario/Mario/poisonmushroom.gif | 0
AMario/Mario/supaturtle.gif | 0
AMario/Mario/super cannon.gif | 0
AMario/Mario/warship1.gif | 0
AMario/Mario/warship2.gif | 0
AMario/Mario/yes.bmp | 0
AMario/Mario/yetileft1.gif | 0
AMario/Mario/yetileft2.gif | 0
AMario/Mario/yetiright1.gif | 0
AMario/Mario/yetiright2.gif | 0
APong.html | 8++++++++
APong/Pong/Pong/paddle.gif | 0
APong/Pong/PongArea.java | 44++++++++++++++++++++++++++++++++++++++++++++
APong/Pong/PongFrame.java | 11+++++++++++
APong/Pong/PongGame.java | 245+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
APong/Pong/java.policy.applet | 7+++++++
APong/Pong/paddle.gif | 0
APong/java.policy.applet | 7+++++++
AREADME.md | 1+
AReaper.html | 8++++++++
AReaper/ReaperArea.java | 188+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AReaper/ReaperFrame.java | 11+++++++++++
AReaper/ReaperGame.java | 827+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AReaper/bod.gif | 0
AReaper/bunny.gif | 0
AReaper/bus.gif | 0
AReaper/fire hydrant.gif | 0
AReaper/g.gif | 0
AReaper/gr.gif | 0
AReaper/gri.gif | 0
AReaper/grim.gif | 0
AReaper/grimr.gif | 0
AReaper/grimre.gif | 0
AReaper/grimrea.gif | 0
AReaper/grimreap.gif | 0
AReaper/grimreape.gif | 0
AReaper/grimreaper.gif | 0
AReaper/grimreaperenemydeafeat.gif | 0
AReaper/grimreaperenemydeafeat2.gif | 0
AReaper/grimreaperwriting.gif | 0
AReaper/missioncomplete.gif | 0
AReaper/one two.gif | 0
AReaper/paddle.gif | 0
AReaper/reaperdead.gif | 0
AReaper/rsqr.gif | 0
AReaper/rsqrfon.gif | 0
AReaper/rsqrkickfon.gif | 0
AReaper/run1.gif | 0
AReaper/run1left.gif | 0
AReaper/run2.gif | 0
AReaper/run2left.gif | 0
AReaper/two two.gif | 0
AReaper/warp.gif | 0
ATank.html | 8++++++++
ATank/TankArea.java | 152+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ATank/TankFrame.java | 11+++++++++++
ATank/TankGame.java | 452+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ATank/arenafloor.gif | 0
ATank/bad-tank-down-2.gif | 0
ATank/bad-tank-down-shoot-2.gif | 0
ATank/bad-tank-down-shoot.gif | 0
ATank/bad-tank-down.gif | 0
ATank/bad-tank-left-2.gif | 0
ATank/bad-tank-left-shoot-2.gif | 0
ATank/bad-tank-left-shoot.gif | 0
ATank/bad-tank-left.gif | 0
ATank/bad-tank-right-2.gif | 0
ATank/bad-tank-right-shoot-2.gif | 0
ATank/bad-tank-right-shoot.gif | 0
ATank/bad-tank-right.gif | 0
ATank/bad-tank-up-2.gif | 0
ATank/bad-tank-up-shoot-2.gif | 0
ATank/bad-tank-up-shoot.gif | 0
ATank/bad-tank-up.gif | 0
ATank/files.txt | 40++++++++++++++++++++++++++++++++++++++++
ATank/pit.gif | 0
ATank/tank-down-2.gif | 0
ATank/tank-down-shoot-2.gif | 0
ATank/tank-down-shoot.gif | 0
ATank/tank-down.gif | 0
ATank/tank-left-2.gif | 0
ATank/tank-left-shoot-2.gif | 0
ATank/tank-left-shoot.gif | 0
ATank/tank-left.gif | 0
ATank/tank-right-2.gif | 0
ATank/tank-right-shoot-2.gif | 0
ATank/tank-right-shoot.gif | 0
ATank/tank-right.gif | 0
ATank/tank-up-2.gif | 0
ATank/tank-up-shoot-2.gif | 0
ATank/tank-up-shoot.gif | 0
ATank/tank-up.gif | 0
AZombie/Zombie/Zombie/explosion1.gif | 0
AZombie/Zombie/Zombie/explosion2.gif | 0
AZombie/Zombie/Zombie/explosion3.gif | 0
AZombie/Zombie/Zombie/person.gif | 0
AZombie/Zombie/Zombie/pit.gif | 0
AZombie/Zombie/Zombie/zombie.gif | 0
AZombie/Zombie/Zombie/zombie.ico | 0
AZombie/Zombie/ZombieArea.java | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AZombie/Zombie/ZombieFrame.java | 11+++++++++++
AZombie/Zombie/ZombieGame.java | 299+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AZombie/Zombie/explosion1.gif | 0
AZombie/Zombie/explosion2.gif | 0
AZombie/Zombie/explosion3.gif | 0
AZombie/Zombie/java.policy.applet | 7+++++++
AZombie/Zombie/person.gif | 0
AZombie/Zombie/pit.gif | 0
AZombie/Zombie/zombie.gif | 0
AZombie/Zombie/zombie.ico | 0
AZombie/java.policy.applet | 7+++++++
AZombies.html | 8++++++++
Aautogen_Reaper.html | 8++++++++
Aautogen_asteroids.html | 8++++++++
Ajava.policy.applet | 7+++++++
457 files changed, 5728 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,11 @@ +resource.h +.project +.classpath +*.class +*.cdb +*.ve2 +*.vep +*.vpj +thumbs.db +CaveGame/mp3s/ +#java.policy.applet diff --git a/CaveGame.html b/CaveGame.html @@ -0,0 +1,8 @@ +<HTML> +<HEAD> +<TITLE>Cave Game</TITLE> +</HEAD> +<BODY> +<APPLET CODE="CaveGame.CaveGame.class" WIDTH=800 HEIGHT=600 X=200 Y=0></APPLET> +</BODY> +</HTML> diff --git a/CaveGame/1ST ROOM.gif b/CaveGame/1ST ROOM.gif Binary files differ. diff --git a/CaveGame/AlbumArtSmall.jpg b/CaveGame/AlbumArtSmall.jpg Binary files differ. diff --git a/CaveGame/AlbumArt_{5A46157A-FA0D-4BB0-A4D7-98AC60E53D2A}_Large.jpg b/CaveGame/AlbumArt_{5A46157A-FA0D-4BB0-A4D7-98AC60E53D2A}_Large.jpg Binary files differ. diff --git a/CaveGame/AlbumArt_{5A46157A-FA0D-4BB0-A4D7-98AC60E53D2A}_Small.jpg b/CaveGame/AlbumArt_{5A46157A-FA0D-4BB0-A4D7-98AC60E53D2A}_Small.jpg Binary files differ. diff --git a/CaveGame/Bridge.java b/CaveGame/Bridge.java @@ -0,0 +1,35 @@ +package CaveGame; + +public class Bridge implements CaveInterface { + CaveGame myParent; + CaveArea myArea; + + public Bridge (CaveGame parent, CaveArea area) { + myParent = parent; + myArea = area; + } + + public void display() { + myArea.currentImage = myArea.bridge; + myParent.showStatus("On the Bridge"); + if (myArea.currentMusic != null) myArea.currentMusic.stop(); + myArea.currentMusic = myArea.ACbridge; + if (myArea.currentMusic != null) myArea.currentMusic.loop(); + myArea.repaint(); + } + + public CaveInterface processA() { + // do nothing + return(this); + } + + public CaveInterface processB() { + // do nothing + return(this); + } + + public CaveInterface processC() { + // do nothing + return(this); + } +}+ \ No newline at end of file diff --git a/CaveGame/Cave2.java b/CaveGame/Cave2.java @@ -0,0 +1,35 @@ +package CaveGame; + +public class Cave2 implements CaveInterface { + CaveGame myParent; + CaveArea myArea; + + public Cave2 (CaveGame parent, CaveArea area) { + myParent = parent; + myArea = area; + } + + public void display() { + myArea.currentImage = myArea.secondCave; + myParent.showStatus("In the second Cave"); + if (myArea.currentMusic != null) myArea.currentMusic.stop(); + myArea.currentMusic = myArea.ACsecondCave; + if (myArea.currentMusic != null) myArea.currentMusic.loop(); + myArea.repaint(); + } + + public CaveInterface processA() { + // do nothing + return(this); + } + + public CaveInterface processB() { + // do nothing + return(this); + } + + public CaveInterface processC() { + // do nothing + return(this); + } +}+ \ No newline at end of file diff --git a/CaveGame/CaveArea.java b/CaveGame/CaveArea.java @@ -0,0 +1,106 @@ +package CaveGame; + +import java.awt.*; +import java.applet.AudioClip; +import java.net.*; + +public class CaveArea extends Panel { + + CaveGame myApplet = null; + Image title[] = new Image[10]; + MediaTracker mt=null; + Image firstRoom, leftDoor, firstCave; + Image river, bridge; + Image cavern, hole, rope; + Image hotRoom, secondCave, gameComplete; + Image currentImage; + + AudioClip ACfirstRoom, ACleftDoor, ACfirstCave; + AudioClip ACriver, ACbridge; + AudioClip ACcavern, AChole, ACrope; + AudioClip AChotRoom, ACsecondCave, ACgameComplete; + AudioClip currentMusic; + + public CaveArea(CaveGame parent) { + mt=new MediaTracker(parent); + myApplet = parent; + + firstRoom = load(parent, "1ST ROOM.gif"); + leftDoor = load(parent, "GAMER PICKS A.gif"); + firstCave = load(parent, "GAMER PICKS C.gif"); + river = load(parent, "GAMER PICKS B.gif"); + bridge = load(parent, "GAMER PICKS B THEN A.gif"); + cavern = load(parent, "GAMER PICKS B THEN B.gif"); + hole = load(parent, "GAMER PICKS B THEN B THEN B.gif"); + rope = load(parent, "GAMER PICKS B THEN B THEN C.gif"); + hotRoom = load(parent, "GAMER PICKS B THEN B THEN A.gif"); + secondCave = load(parent, "GAMER PICKS B THEN B THEN A THEN B.gif"); + gameComplete = load(parent, "GAME COMPLETE.gif"); + + ACfirstRoom = loadSound(parent, "The Prophecy.mp3"); + ACleftDoor = loadSound(parent, "The Black Rider.mp3"); + ACfirstCave = loadSound(parent, "The Shadow of the Past.mp3"); + ACriver = loadSound(parent, "The Great River.mp3"); + ACbridge = loadSound(parent, "Flight to the Ford.mp3"); + ACcavern = loadSound(parent, "A Journey in the Dark.mp3"); + AChole = loadSound(parent, "A Knife in the Dark.mp3"); + ACrope = loadSound(parent, "Amon Hen.mp3"); + AChotRoom = loadSound(parent, "The Bridge of Khazad Dhum.mp3"); + ACsecondCave = loadSound(parent, "The Treason of Isengard.mp3"); + ACgameComplete = loadSound(parent, "Concerning Hobbits.mp3"); + + } + + Image load(CaveGame parent, String picture) { + Image im = parent.getImage(myApplet.getCodeBase(), "CaveGame\\" + picture); + checkImage(im, picture); + return(im); + } + + AudioClip loadSound(CaveGame parent, String soundfile) { + AudioClip s = null; + s = parent.getAudioClip(myApplet.getCodeBase(), "CaveGame\\"+soundfile); + checkAudio(s, soundfile); + return (s); + } + + void checkAudio(AudioClip ac, String name) { + if (ac == null) System.out.println("Audio Clip Not found: "+name.toString()); + } + + void checkImage(Image image, String name) { + if (mt != null) { + mt.addImage(image,0); + try { + mt.waitForID(0,5000); + } + catch (InterruptedException ie) { + // nothing to do + } + if (mt.isErrorID(0)) System.out.println("Image Not found: "+name.toString()); + } + } + + public synchronized void paint (Graphics g) { + if (myApplet == null) return; + final int w = getBounds().width; + final int h = getBounds().height; + g.setColor(Color.white); + FontMetrics fm = getFontMetrics(getFont()); + + g.setColor(Color.black); + int asc = fm.getAscent() + 4; + + g.drawImage(currentImage, 0, 0,Color.white, null); + + } + + public void showTitle(Graphics g) { + for (int i = 0; i < 10; i++) { + g.drawImage(title[i], myApplet.getBounds().width/2, getBounds().height/2,Color.white, null); + try {Thread.sleep(50);} + catch (Exception e) {} + } + } + +}+ \ No newline at end of file diff --git a/CaveGame/CaveFrame.java b/CaveGame/CaveFrame.java @@ -0,0 +1,10 @@ +package CaveGame; + +import java.awt.Frame; + +public class CaveFrame extends Frame { + + public CaveFrame() { + setBounds(200, 200, 200, 150); + } +}+ \ No newline at end of file diff --git a/CaveGame/CaveGame.java b/CaveGame/CaveGame.java @@ -0,0 +1,85 @@ +//* Copyright (c) Mary Percival 2003 */ +/* CaveGame game Created December 2003 */ + +package CaveGame; + +import java.awt.*; +import java.awt.event.*; +import java.applet.*; + +public class CaveGame extends Applet implements KeyListener { + + static boolean finished = false; + CaveArea area; + CaveInterface currentCavern; + + // ************************************************************* + public void init() { + + setLayout(null); + setBackground(Color.white); + + area = new CaveArea(this); + add(area); + + FontMetrics fm = getFontMetrics(getFont()); + area.setVisible(true); + area.setBounds(0,0,getBounds().width,getBounds().height); + + addKeyListener(this); + area.addKeyListener(this); + area.requestFocus(); + start(); + } + + public void start() { + currentCavern = new FirstRoom(this, area); + currentCavern.display(); + area.repaint(); + showStatus("CaveGame Started"); + } + + public void finished() { + finished = true; + System.exit(0); + } + + public String getAppletInfo() { + return ("CaveGame Game"); + } + + // this class will use just the key pressed event + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_A) { + currentCavern = currentCavern.processA(); + currentCavern.display(); + area.repaint(); + } + else if (e.getKeyCode() == KeyEvent.VK_B) { + currentCavern = currentCavern.processB(); + currentCavern.display(); + area.repaint(); + } + else if (e.getKeyCode() == KeyEvent.VK_C) { + currentCavern = currentCavern.processC(); + currentCavern.display(); + area.repaint(); + } + else if (e.getKeyCode() == KeyEvent.VK_ENTER) { + start(); + area.repaint(); + } + } + + synchronized void die() { + showStatus("The Player is dead. Press the Enter key to restart"); + finished = true; + } + + public void keyReleased(KeyEvent e) { + } + + public void keyTyped(KeyEvent e) { + } + +}+ \ No newline at end of file diff --git a/CaveGame/CaveInterface.java b/CaveGame/CaveInterface.java @@ -0,0 +1,10 @@ +package CaveGame; + +public interface CaveInterface { + // interface that each cavern implements + void display(); + CaveInterface processA(); + CaveInterface processB(); + CaveInterface processC(); + +}+ \ No newline at end of file diff --git a/CaveGame/Cavern.java b/CaveGame/Cavern.java @@ -0,0 +1,32 @@ +package CaveGame; + +public class Cavern implements CaveInterface { + CaveGame myParent; + CaveArea myArea; + + public Cavern (CaveGame parent, CaveArea area) { + myParent = parent; + myArea = area; + } + + public void display() { + myArea.currentImage = myArea.cavern; + myParent.showStatus("In the Cavern"); + if (myArea.currentMusic != null) myArea.currentMusic.stop(); + myArea.currentMusic = myArea.ACcavern; + if (myArea.currentMusic != null) myArea.currentMusic.loop(); + myArea.repaint(); + } + + public CaveInterface processA() { + return(new HotRoom(myParent, myArea)); + } + + public CaveInterface processB() { + return(new Hole(myParent, myArea)); + } + + public CaveInterface processC() { + return(new Rope(myParent, myArea)); + } +}+ \ No newline at end of file diff --git a/CaveGame/FirstCave.java b/CaveGame/FirstCave.java @@ -0,0 +1,35 @@ +package CaveGame; + +public class FirstCave implements CaveInterface { + CaveGame myParent; + CaveArea myArea; + + public FirstCave (CaveGame parent, CaveArea area) { + myParent = parent; + myArea = area; + } + + public void display() { + myArea.currentImage = myArea.firstCave; + if (myArea.currentMusic != null) myArea.currentMusic.stop(); + myArea.currentMusic = myArea.ACfirstCave; + if (myArea.currentMusic != null) myArea.currentMusic.loop(); + myParent.showStatus("In the First Cave"); + myArea.repaint(); + } + + public CaveInterface processA() { + // do nothing + return(this); + } + + public CaveInterface processB() { + // do nothing + return(this); + } + + public CaveInterface processC() { + // do nothing + return(this); + } +}+ \ No newline at end of file diff --git a/CaveGame/FirstRoom.java b/CaveGame/FirstRoom.java @@ -0,0 +1,32 @@ +package CaveGame; + +public class FirstRoom implements CaveInterface{ + CaveGame myParent; + CaveArea myArea; + + public FirstRoom(CaveGame parent, CaveArea area) { + myParent = parent; + myArea = area; + } + + public void display() { + myArea.currentImage = myArea.firstRoom; + if (myArea.currentMusic != null) myArea.currentMusic.stop(); + myArea.currentMusic = myArea.ACfirstRoom; + if (myArea.currentMusic != null) myArea.currentMusic.loop(); + myParent.showStatus("Just Inside the Entrance"); + myArea.repaint(); + } + + public CaveInterface processA() { + return new LeftDoor(myParent, myArea); + } + + public CaveInterface processB() { + return new River(myParent, myArea); + } + + public CaveInterface processC() { + return new FirstCave(myParent, myArea); + } +}+ \ No newline at end of file diff --git a/CaveGame/Folder.jpg b/CaveGame/Folder.jpg Binary files differ. diff --git a/CaveGame/GAME COMPLETE.gif b/CaveGame/GAME COMPLETE.gif Binary files differ. diff --git a/CaveGame/GAMER PICKS A.gif b/CaveGame/GAMER PICKS A.gif Binary files differ. diff --git a/CaveGame/GAMER PICKS B THEN A.gif b/CaveGame/GAMER PICKS B THEN A.gif Binary files differ. diff --git a/CaveGame/GAMER PICKS B THEN B THEN A THEN B.gif b/CaveGame/GAMER PICKS B THEN B THEN A THEN B.gif Binary files differ. diff --git a/CaveGame/GAMER PICKS B THEN B THEN A.gif b/CaveGame/GAMER PICKS B THEN B THEN A.gif Binary files differ. diff --git a/CaveGame/GAMER PICKS B THEN B THEN B.gif b/CaveGame/GAMER PICKS B THEN B THEN B.gif Binary files differ. diff --git a/CaveGame/GAMER PICKS B THEN B THEN C.gif b/CaveGame/GAMER PICKS B THEN B THEN C.gif Binary files differ. diff --git a/CaveGame/GAMER PICKS B THEN B.gif b/CaveGame/GAMER PICKS B THEN B.gif Binary files differ. diff --git a/CaveGame/GAMER PICKS B.gif b/CaveGame/GAMER PICKS B.gif Binary files differ. diff --git a/CaveGame/GAMER PICKS C.gif b/CaveGame/GAMER PICKS C.gif Binary files differ. diff --git a/CaveGame/Gamer picks b) then b) then a) then a) then a).gif b/CaveGame/Gamer picks b) then b) then a) then a) then a).gif Binary files differ. diff --git a/CaveGame/Gamer picks b) then b) then a) then a) then b).gif b/CaveGame/Gamer picks b) then b) then a) then a) then b).gif Binary files differ. diff --git a/CaveGame/Gamer picks b) then b) then a) then a).gif b/CaveGame/Gamer picks b) then b) then a) then a).gif Binary files differ. diff --git a/CaveGame/Hole.java b/CaveGame/Hole.java @@ -0,0 +1,35 @@ +package CaveGame; + +public class Hole implements CaveInterface { + CaveGame myParent; + CaveArea myArea; + + public Hole (CaveGame parent, CaveArea area) { + myParent = parent; + myArea = area; + } + + public void display() { + myArea.currentImage = myArea.hole; + if (myArea.currentMusic != null) myArea.currentMusic.stop(); + myArea.currentMusic = myArea.AChole; + if (myArea.currentMusic != null) myArea.currentMusic.loop(); + myParent.showStatus("In the Hole"); + myArea.repaint(); + } + + public CaveInterface processA() { + // do nothing + return(this); + } + + public CaveInterface processB() { + // do nothing + return(this); + } + + public CaveInterface processC() { + // do nothing + return(this); + } +}+ \ No newline at end of file diff --git a/CaveGame/HotRoom.java b/CaveGame/HotRoom.java @@ -0,0 +1,33 @@ +package CaveGame; + +public class HotRoom implements CaveInterface { + CaveGame myParent; + CaveArea myArea; + + public HotRoom (CaveGame parent, CaveArea area) { + myParent = parent; + myArea = area; + } + + public void display() { + myArea.currentImage = myArea.hotRoom; + if (myArea.currentMusic != null) myArea.currentMusic.stop(); + myArea.currentMusic = myArea.AChotRoom; + if (myArea.currentMusic != null) myArea.currentMusic.loop(); + myParent.showStatus("In the Hot Room"); + myArea.repaint(); + } + + public CaveInterface processA() { + return(new WayOut(myParent, myArea)); + } + + public CaveInterface processB() { + return(new Cave2(myParent, myArea)); + } + + public CaveInterface processC() { + // do nothing + return(this); + } +}+ \ No newline at end of file diff --git a/CaveGame/LeftDoor.java b/CaveGame/LeftDoor.java @@ -0,0 +1,35 @@ +package CaveGame; + +public class LeftDoor implements CaveInterface { + CaveGame myParent; + CaveArea myArea; + + public LeftDoor(CaveGame parent, CaveArea area) { + myParent = parent; + myArea = area; + } + + public void display() { + myArea.currentImage = myArea.leftDoor; + if (myArea.currentMusic != null) myArea.currentMusic.stop(); + myArea.currentMusic = myArea.ACleftDoor; + if (myArea.currentMusic != null) myArea.currentMusic.loop(); + myParent.showStatus("Through the Left Door"); + myArea.repaint(); + } + + public CaveInterface processA() { + // do nothing + return(this); + } + + public CaveInterface processB() { + // do nothing + return(this); + } + + public CaveInterface processC() { + // do nothing + return(this); + } +}+ \ No newline at end of file diff --git a/CaveGame/River.java b/CaveGame/River.java @@ -0,0 +1,33 @@ +package CaveGame; + +public class River implements CaveInterface { + CaveGame myParent; + CaveArea myArea; + + public River (CaveGame parent, CaveArea area) { + myParent = parent; + myArea = area; + } + + public void display() { + myArea.currentImage = myArea.river; + if (myArea.currentMusic != null) myArea.currentMusic.stop(); + myArea.currentMusic = myArea.ACriver; + if (myArea.currentMusic != null) myArea.currentMusic.loop(); + myParent.showStatus("By the River"); + myArea.repaint(); + } + + public CaveInterface processA() { + return(new Bridge(myParent, myArea)); + } + + public CaveInterface processB() { + return(new Cavern(myParent, myArea)); + } + + public CaveInterface processC() { + // do nothing + return(this); + } +}+ \ No newline at end of file diff --git a/CaveGame/Rope.java b/CaveGame/Rope.java @@ -0,0 +1,35 @@ +package CaveGame; + +public class Rope implements CaveInterface { + CaveGame myParent; + CaveArea myArea; + + public Rope (CaveGame parent, CaveArea area) { + myParent = parent; + myArea = area; + } + + public void display() { + myArea.currentImage = myArea.rope; + if (myArea.currentMusic != null) myArea.currentMusic.stop(); + myArea.currentMusic = myArea.ACrope; + if (myArea.currentMusic != null) myArea.currentMusic.loop(); + myParent.showStatus("Down the Rope"); + myArea.repaint(); + } + + public CaveInterface processA() { + // do nothing + return(this); + } + + public CaveInterface processB() { + // do nothing + return(this); + } + + public CaveInterface processC() { + // do nothing + return(this); + } +}+ \ No newline at end of file diff --git a/CaveGame/WayOut.java b/CaveGame/WayOut.java @@ -0,0 +1,35 @@ +package CaveGame; + +public class WayOut implements CaveInterface { + CaveGame myParent; + CaveArea myArea; + + public WayOut (CaveGame parent, CaveArea area) { + myParent = parent; + myArea = area; + } + + public void display() { + myArea.currentImage = myArea.gameComplete; + if (myArea.currentMusic != null) myArea.currentMusic.stop(); + myArea.currentMusic = myArea.ACgameComplete; + if (myArea.currentMusic != null) myArea.currentMusic.loop(); + myParent.showStatus("At the Exit"); + myArea.repaint(); + } + + public CaveInterface processA() { + // do nothing + return(this); + } + + public CaveInterface processB() { + // do nothing + return(this); + } + + public CaveInterface processC() { + // do nothing + return(this); + } +}+ \ No newline at end of file diff --git a/CaveGame/desktop.ini b/CaveGame/desktop.ini Binary files differ. diff --git a/Easter/Easter/Easter.java b/Easter/Easter/Easter.java @@ -0,0 +1,111 @@ +package Easter; + + +public class Easter +{ + private static String USER1 = "Michael"; + private static String USER2 = "Stephen"; + private static String CONSTANT1 = "DFCHQ"; + private static String CONSTANT2 ="MAINCOREOFWEAS"; + /** + * Main entry point for Easter class. + * + * @param parameters is an array of string parameters of any size + * 'void' means it doesn't return a result value, like a function would + * don't worry about the 'static' word - it's mandatory for standalone programs + */ + public static void main(String[] parameters) + { + int i = 0; + String valuea = ""; + String valueb = ""; + String text = "Go and look here: "; + boolean variable1 = true, variable2 = false, variable3 = true; + if (parameters.length < 1) + { + System.out.println("Please put your name as the parameter to this program and try running it again"); + } + else if (USER1.equalsIgnoreCase(parameters[0]) || USER2.equalsIgnoreCase(parameters[0])) // || means 'OR' + { + System.out.println("Welcome, " + parameters[0]); // print out to the screen element 0 (the first element) in the array + if (USER1.equalsIgnoreCase(parameters[0])) // case-independent comparison, i.e. 'M' matches 'm' + { + valuea = CONSTANT1; + if (variable1 || variable2) + { + valuea = valuea + 'E'; + } + if (variable2 && variable3) // && means 'AND' + { + valuea = valuea + 'E'; + } + valueb = doSomething(valuea); + i = 0; + while (i < valueb.length()) + { + // add 1 to character at position i + char c = (char) (valueb.charAt(i) + 1); // in order to add 1 to a character it has to be of type 'char' rather than String - don't worry about it! + text = text + c; // charAt(i) gives you the character at position(i). NB first character is at position 0 + i = i + 1; + } + } + else if (USER2.equalsIgnoreCase(parameters[0])) + { + valueb = CONSTANT2; + // charAt(i) gives you the character at position(i). NB first character is at position 0 + // && means 'AND'; 0x in front of a number means that number is hexadecimal + if (0x11 > 15 && USER1.charAt(0) > valueb.charAt(0)) + { + valueb = valueb + "AV"; + } + else + { + valueb = valueb + "VA"; + } + if (Math.sqrt(121) > 8) // sqrt means 'square root' + { + valueb = valueb + 'E'; + } + else + { + valueb = valueb + 'A'; + } + if (variable1 && (variable2 || variable3)) // && means 'AND'; || means 'OR' + { + valueb = valueb + 'R'; + } + else + { + valueb = valueb + 'S'; + } + i = 0; + while (i < valueb.length()) + { + if (i % 2 == 0) // % is the modulo or 'remainder' function (i.e. remainder from dividing) and != means not equal to + { + text = text + (valueb.charAt(i)); // charAt(i) gives you the character at position(i). NB first character is at position 0 + } + i = i + 1; + } + } + System.out.println(text); + } + else + { + System.out.println("Sorry, " + parameters[0] + " gets nothing"); + } + + } + + private static String doSomething(String input) + { + String result = ""; + if (input.length() > 1) + { + result = doSomething(input.substring(1, input.length())); // do something with the substring minus the first character (substring from element 1 to the end) + } + result = result + input.charAt(0); // charAt(0) means the first character + return result; + } + +}+ \ No newline at end of file diff --git a/Link.html b/Link.html @@ -0,0 +1,8 @@ +<HTML> +<HEAD> +<TITLE>The Adventures of Link</TITLE> +</HEAD> +<BODY> +<APPLET CODE="Link.LinkGame.class" WIDTH=800 HEIGHT=600 X=200 Y=0></APPLET> +</BODY> +</HTML> diff --git a/Link/LinkArea.java b/Link/LinkArea.java @@ -0,0 +1,144 @@ +package Link; + +import java.awt.*; + +public class LinkArea extends Panel { + + static final int FLOORLEVEL = 587; + static final int FLOORWIDTH = 150; + LinkGame myApplet = null; + Image yellowgem; + Image spider; + Image obstacle; + Image redgem; + Image octopellets; + Image octo; + Image madblob; + Image heroswordright; + Image heroswordleft; + Image herostand; + Image hero1; + Image hero2; + Image herostandleft; + Image hero1left; + Image hero2left; + Image heroshieldright; + Image heroshieldleft; + Image greengem; + Image bluegem; + Image goldskullata; + Image gemstandgems; + Image gemstandempty; + Image blob; + MediaTracker mt=null; + + public LinkArea(LinkGame parent) { + mt=new MediaTracker(parent); + myApplet = parent; + yellowgem = load(myApplet, "yellowgem.gif"); + spider = load(myApplet, "spider.gif"); + obstacle = load(myApplet, "rock.gif"); + redgem = load(myApplet, "redgem.gif"); + octopellets = load(myApplet, "octopellets.gif"); + octo = load(myApplet, "octo.gif"); + madblob = load(myApplet, "madblob.gif"); + heroswordright = load(myApplet, "linkswordright.gif"); + heroswordleft = load(myApplet, "linkswordleft.gif"); + herostand = load(myApplet, "linkstandright.gif"); + hero1 = load(myApplet, "linkstandright.gif"); + hero2 = load(myApplet, "linkstandright2.gif"); + herostandleft = load(myApplet, "linkstandleft.gif"); + hero1left = load(myApplet, "linkstandleft.gif"); + hero2left = load(myApplet, "linkstandleft2.gif"); + heroshieldright = load(myApplet, "linkshieldright.gif"); + heroshieldleft = load(myApplet, "linkshieldleft.gif"); + greengem = load(myApplet, "greengem.gif"); + bluegem = load(myApplet, "bluegem.gif"); + goldskullata = load(myApplet, "goldskullata.gif"); + gemstandgems = load(myApplet, "gemstand(with gems).gif"); + gemstandempty = load(myApplet, "gemstand(without gems).gif"); + blob = load(myApplet, "blob.gif"); + } + void checkImage(Image image, String name) { + if (mt != null) { + mt.addImage(image,0); + try { + mt.waitForID(0,5000); + } + catch (InterruptedException ie) { + // nothing to do + } + if (mt.isErrorID(0)) System.out.println("Image Not found: "+name.toString()); + } + } + + Image load(LinkGame parent, String picture) { + Image im = parent.getImage(myApplet.getCodeBase(), "Link\\" + picture); + checkImage(im, picture); + return(im); + } + + public synchronized void paint (Graphics g) { + Image obstacleimage; + if (myApplet == null) return; + final int w = getBounds().width; + final int h = getBounds().height; + g.setColor(Color.white); + g.fillRect(0, 0, w, h); + FontMetrics fm = getFontMetrics(getFont()); + + g.setColor(Color.black); + int asc = fm.getAscent() + 4; + /* + // paint the floor + for (int pos=0; pos < w; pos+=FLOORWIDTH) { + g.drawImage(floor,pos, FLOORLEVEL,Color.black, null); + } + */ + + if (myApplet.obstaclePositions != null) { + // show the obstacles + for (int i=0; i < myApplet.obstaclePositions.length; i++) { + obstacleimage = myApplet.getObstacleImage(i); + g.drawImage(obstacleimage, myApplet.obstaclePositions[myApplet.level-1][i].x, myApplet.obstaclePositions[myApplet.level-1][i].y-4,Color.white, null); + } + } + + /* + // show the enemies + for (int i=0; i < myApplet.enemyPositions.length; i++) { + if (myApplet.enemyPositions[i].x > -1) + g.drawImage(enemyImage, myApplet.enemyPositions[i].x, myApplet.enemyPositions[i].y,null); + } + } + */ + // draw Hero (on top of preceding images) + if (myApplet.playerPosition != null) { + // show the player + Image herosimage = myApplet.getHeroImage(); + /* + if (myApplet.herocrouching) { + if (myApplet.heroleft) + herosimage = herocrouchleft; + else + herosimage = herocrouch; + } + if (myApplet.jumping) { + if (myApplet.heroleft) + herosimage = herojumpleft; + else + herosimage = herojump; + } + */ + g.drawImage(herosimage, myApplet.playerPosition.x, myApplet.playerPosition.y,/*Color.white,*/ null); + } + /* + // draw warp image (on top of Hero) + if (myApplet.warpzone != null) { + // show the warp zone at the end of the level + g.drawImage(herowarp, myApplet.warpzone.x, myApplet.warpzone.y,Color.white, null); + } + */ + + } +}+ \ No newline at end of file diff --git a/Link/LinkFrame.java b/Link/LinkFrame.java @@ -0,0 +1,10 @@ +package Link; + +import java.awt.Frame; + +public class LinkFrame extends Frame { + + public LinkFrame() { + setBounds(200, 200, 200, 150); + } +}+ \ No newline at end of file diff --git a/Link/LinkGame.java b/Link/LinkGame.java @@ -0,0 +1,544 @@ +/* Copyright (c) Mary Percival 2003 */ +/* Link game Created May 2003 */ + +package Link; + +import java.awt.*; +import java.awt.event.*; +import java.applet.*; + +public class LinkGame extends Applet implements KeyListener, Runnable { + // all member variables 'static' because shared with the enemy action thread + static LinkArea area; + static boolean finished = false; + static boolean ingame = false; + static boolean juststarted = false; + static int level = 1; + static Point[] enemyPositions; + static Point playerPosition; + static Point[][] obstaclePositions; + static int direction[]; + Thread timer; + static int enemyNumber=1, enemiesRemaining=1, obstacleNumber=1; + static boolean herocrouching = false; + static final int MAXLEVELS = 1; + static final int levellengths[] = new int[MAXLEVELS]; + boolean hasWeaponOut=false; + + static int LEFT=-1; + static int RIGHT=1; + + // the next 2 constants are overridden in init once we know the screen size + static int RIGHTEDGE = 789; + static int BOTTOMEDGE = 900; + // + static Point IMAGESIZE=new Point(152,107); + static Point HEROPOS = new Point(63,28); + static final int LEFTEDGE = -15; + static final int TOPEDGE = -10; + static final int FALLAMOUNT=16; // amount he falls each time interval + static final int RISEAMOUNT=16; // amount he rises each time interval + static int GROUNDLEVEL = 500; + static int XAMOUNT=5; + static int YAMOUNT=5; + static int JUMPAMOUNT=70; + static final int X = 1; + static final int Y = 2; + static final int NOT=3; + static final int DELAY = 60; + + static int heroImageNo = 0; + static final int OBSTACLEIMAGES = 1; + static final int HEROIMAGES = 4; + static Image[] heroImages = new Image[HEROIMAGES]; + static Image[] obstacleImages = new Image[OBSTACLEIMAGES]; // obstacles don't move + static int obstacleImageNo[]; + static boolean heroleft = false; + static boolean jumping = false; + static Point warpzone; + //static boolean superjump = false; + static final int JUMPDURATION=5; + static final int SUPERJUMPDURATION=8; + static final int LEFTOFOBSTACLE = 27; + static final int RIGHTOFOBSTACLE = 33; + static int[] keysdown = new int[4]; + static final int LEFTDOWN=0; + static final int RIGHTDOWN=1; + static final int DOWNDOWN=2; + static final int SPACEDOWN=3; + + static final int OBSTACLEHEIGHT=42; + boolean onTheWayUp=false; + static int startPosY = GROUNDLEVEL; + + public void init() { + + setLayout(null); + setBackground(Color.white); + + area = new LinkArea(this); + add(area); + FontMetrics fm = getFontMetrics(getFont()); + XAMOUNT = 12; + YAMOUNT = 12; + RIGHTEDGE = (getBounds().width/XAMOUNT)*XAMOUNT +LEFTEDGE; + BOTTOMEDGE = getBounds().height - 1; + setVisible(true); + area.setBounds(0,0,getBounds().width,BOTTOMEDGE); + area.setVisible(true); + + addKeyListener(this); + area.addKeyListener(this); + area.requestFocus(); + + levellengths[0] = RIGHTEDGE; + obstacleImages[0] = area.obstacle; + + timer = new Thread(this); + timer.start(); + + } + + public void start() { + // called by Applet Viewer or Browser + doLevel(1); + } + + synchronized void faceRight() { + heroImages[0] = area.herostand; + heroImages[1] = area.hero1; + heroImages[2] = area.herostand; + heroImages[3] = area.hero2; + heroImageNo = 0; + heroleft=false; + } + + synchronized void faceLeft() { + heroImages[0] = area.herostandleft; + heroImages[1] = area.hero1left; + heroImages[2] = area.herostandleft; + heroImages[3] = area.hero2left; + heroImageNo = 0; + heroleft=true; + } + + synchronized void getSwordOut() { + hasWeaponOut = true; + if (heroleft) { + heroImages[0] = area.heroswordleft; + heroImages[1] = area.heroswordleft; + heroImages[2] = area.heroswordleft; + heroImages[3] = area.heroswordleft; + } + else { + heroImages[0] = area.heroswordright; + heroImages[1] = area.heroswordright; + heroImages[2] = area.heroswordright; + heroImages[3] = area.heroswordright; + } + heroImageNo = 0; + } + + synchronized void getShieldOut() { + hasWeaponOut = true; + if (heroleft) { + heroImages[0] = area.heroshieldleft; + heroImages[1] = area.heroshieldleft; + heroImages[2] = area.heroshieldleft; + heroImages[3] = area.heroshieldleft; + } + else { + heroImages[0] = area.heroshieldright; + heroImages[1] = area.heroshieldright; + heroImages[2] = area.heroshieldright; + heroImages[3] = area.heroshieldright; + } + heroImageNo = 0; + } + + synchronized void putWeaponAway() { + hasWeaponOut = false; + if (heroleft) faceLeft(); + else faceRight(); + } + + synchronized void standStill() { + heroImageNo = 0; + } + + public void doLevel(int level) { + // this runs one 'level' + juststarted = true; + Point temppoint; + + showStatus("Started level " + level); + + // position Hero at the bottom left + playerPosition = new Point(LEFTEDGE,GROUNDLEVEL); + faceRight(); + + // initialise obstacle states + obstacleImageNo = new int[obstacleNumber]; + obstacleImageNo[0] = 0; + + // initialise the arrays of enemies, etc + enemyPositions = new Point[enemyNumber]; + obstaclePositions = new Point[MAXLEVELS][obstacleNumber]; + direction = new int[enemyNumber]; + for (int i=0; i < enemyNumber; i++) { + enemyPositions[i] = new Point(RIGHTEDGE, GROUNDLEVEL); + direction[i] = LEFT; + } + for (int i=0; i < obstacleNumber; i++) { + switch(level) { + case 1: + obstaclePositions[level-1][i] = new Point((RIGHTEDGE+15)/2, GROUNDLEVEL); + System.out.println("Obstacle positioned at (" + (RIGHTEDGE-LEFTEDGE)/2+", " + GROUNDLEVEL + ")"); + break; + default: + } + } + + // position the warp zone at the end of the level + warpzone = new Point(levellengths[level-1], GROUNDLEVEL); + + // paint the panel here + //area.repaint(); + ingame = true; + } + + Point randomPosition() { + return new Point( (int) (Math.random() * RIGHTEDGE) / XAMOUNT * XAMOUNT, + (int) (Math.random() * BOTTOMEDGE) / YAMOUNT * YAMOUNT); + } + + boolean isPlayerPosition(Point p) { + return(p.x == playerPosition.x && p.y == playerPosition.y); + } + + boolean isEnemyPosition(Point p) { + for (int i = 0 ; i < enemyNumber; i++) { + if(p.x == enemyPositions[i].x && p.y == enemyPositions[i].y) return(true); + } + return(false); + } + + boolean isObstaclePosition(Point p) { + for (int i = 0 ; i < obstacleNumber; i++) { + if(isObstacleX(p) != -1 && isObstacleY(p) != -1) { + return(true); + } + } + return(false); + } + + boolean checkIfBlockingObstacle(Point p) { + boolean result = false; + for (int i = 0 ; i < obstacleNumber; i++) { + if(isObstacleX(p) != -1 && isBlockingObstacleY(p) != -1) { + //piranhaPopping[i] = false; + result = true; + } + //else piranhaPopping[i] = true; + } + if (!result) startPosY = GROUNDLEVEL; + return(result); + } + + int isObstacleX(Point p) { + int obstaclex; + for (int i = 0 ; i < obstacleNumber; i++) { + // if x is >= obstacleposition - (LEFTOFOBSTACLE) and x <= obstacleposition + (RIGHTOFOBSTACLE) + obstaclex = obstaclePositions[level-1][i].x; + if(p.x >= (obstaclex - LEFTOFOBSTACLE) && p.x <= (obstaclex + RIGHTOFOBSTACLE)) + return(i); // return the number of the matching obstacle + } + return(-1); + } + + int isBlockingObstacleY(Point p) { + for (int i = 0 ; i < obstacleNumber; i++) { + if(p.y <= obstaclePositions[level-1][i].y-OBSTACLEHEIGHT) return(i); + } + return(-1); + } + + int isObstacleY(Point p) { + for (int i = 0 ; i < obstacleNumber; i++) { + if(p.y > obstaclePositions[level-1][i].y-OBSTACLEHEIGHT) return(i); + } + return(-1); + } + + public void finished() { + finished = true; + System.exit(0); + } + + public String getAppletInfo() { + return ("Link Game"); + } + + int randomMove() { + // return + or - value (randomly) + if (Math.random() >= 0.5) return(24); + else return(-24); + } + + private synchronized void incKeysDown(int whichone) { + keysdown[whichone] = 1; + } + + private synchronized void decKeysDown(int whichone) { + keysdown[whichone] = 0; + } + + // this class will use just the key pressed event + public void keyPressed(KeyEvent e) { + if (ingame) { + if (! + ((e.getKeyCode() == KeyEvent.VK_LEFT && playerPosition.x <= (LEFTEDGE + XAMOUNT)) || + (e.getKeyCode() == KeyEvent.VK_RIGHT && playerPosition.x >= (RIGHTEDGE - XAMOUNT)))) { + // valid move: move the player and then move the enemies + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + herocrouching = true; + incKeysDown(DOWNDOWN); + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + incKeysDown(LEFTDOWN); + leftPressed(); + } + else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + incKeysDown(RIGHTDOWN); + rightPressed(); + } + else if (e.getKeyCode() == KeyEvent.VK_SPACE) { + //System.out.println("Jump when jumping is " + jumping); + if (!jumping) { + //incKeysDown(SPACEDOWN); + startPosY = playerPosition.y; + jumping = true; + onTheWayUp=true; + } + } + else if (e.getKeyCode() == KeyEvent.VK_Z) { + getSwordOut(); + } + else if (e.getKeyCode() == KeyEvent.VK_X) { + getShieldOut(); + } + if (isEnemyPosition(playerPosition)) { + showStatus("The Player ran into an enemy!! Press the Enter key to restart the level"); + ingame = false; + } + //area.repaint(); + //showStatus("Hero's position = (" + playerPosition.x + ", " + playerPosition.y + ")"); + showStatus(" "); + } // if valid key press + } + else if (e.getKeyCode() == KeyEvent.VK_ENTER) { + doLevel(level++); + } + } + + void leftPressed() { + if (!herocrouching) { + //superjump = true; // if jumping + // if Hero was facing right, turn him left + if (!heroleft && !hasWeaponOut) + faceLeft(); + else { + // if the target position is not occupied by a obstacle... + for (int i=0; i < obstacleNumber; i++) { + if (isObstaclePosition(new Point(playerPosition.x-XAMOUNT, playerPosition.y))) + return; // can't move + } + playerPosition.x -= XAMOUNT; + incrementHeroImage(); + } + } + } + + void rightPressed() { + if (!herocrouching) { + //superjump = true; // if jumping + // if Hero was facing left, turn him right + if (heroleft && !hasWeaponOut) + faceRight(); + else { + for (int i=0; i < obstacleNumber; i++) { + if (isObstaclePosition(new Point(playerPosition.x+XAMOUNT, playerPosition.y))) + return; // can't move + } + playerPosition.x += XAMOUNT; + incrementHeroImage(); + } + } + } + + public void run() { + while (true) { + if (juststarted) { + try {Thread.sleep(750);} + catch (Exception e) {} + area.repaint(); + juststarted = false; + } + try {Thread.sleep(DELAY);} + catch (InterruptedException e){} + if (ingame) { + //System.out.println("Run: BEFORE: Hero's position = (" + playerPosition.x + ", " + playerPosition.y + ")"); + if (keysdown[LEFTDOWN] == 0 && + keysdown[RIGHTDOWN] == 0 && + keysdown[DOWNDOWN] == 0 /*&& + keysdown[SPACEDOWN] == 0*/) standStill(); + + if (keysdown[LEFTDOWN] > 0) leftPressed(); + else if (keysdown[RIGHTDOWN] > 0) rightPressed(); + + // for each obstacle, cycle through the piranha pictures + for (int i=0; i < obstacleNumber; i++) { + incrementObstacleImage(i); + } + + /* + // for each enemy, move the enemy in the direction it was going + for (int i=0; i < enemyPositions.length; i++) { + if (!deadHero(enemyPositions[i])) { + enemyPositions[i] = move(enemyPositions[i], direction[i]); + } + // if there is a obstacle at that position, fall into it and decrement count of enemies + // and set that enemy's position to -1, -1 + if (isObstaclePosition(enemyPositions[i])) { + showStatus("A enemy fell into a obstacle"); + + enemyPositions[i] = new Point(-1, -1); + enemiesRemaining--; + showStatus(enemyNumber-enemiesRemaining + " down, " + enemiesRemaining + " to go..."); + } + // if player is caught by a enemy or all enemies are gone, end the game + if (isPlayerPosition(enemyPositions[i])) { + showStatus("\"Mmm! Brains...\". The Player is dead. Press the Enter key to restart the level"); + level--; // because it will be incremented in a minute and we want to stay on the same 'level' + ingame = false; + } + } + if (enemiesRemaining == 0) { + showStatus("All the enemies are gone -- you won!! Press the Enter key to start the next level"); + enemyNumber++; + if (obstacleNumber > 2) obstacleNumber--; + ingame = false; + } + */ + if (onTheWayUp) { + //System.out.println("OnTheWayUp. Start Y Position =" + startPosY); + if (playerPosition.y > startPosY-JUMPAMOUNT) + playerPosition = new Point(playerPosition.x, playerPosition.y - RISEAMOUNT); + else { + onTheWayUp=false; + } + } + else { + int obstacleno = isObstacleX(playerPosition); + if (obstacleno == -1) { // no obstacle at this position + if (onTheWayUp == false) { + if (playerPosition.y < startPosY) + playerPosition = new Point(playerPosition.x, playerPosition.y+FALLAMOUNT); + else jumping = false; + } + } + else { + Point obstaclepos = obstaclePositions[level-1][obstacleno]; + // if hero's y position <= obstacle's height + if (playerPosition.y <= (obstaclepos.y-OBSTACLEHEIGHT)) { // can't land on the obstacle if just < (??!) + // allow hero to land on the obstacle + //System.out.println("Allow Hero to land (or stay) on obstacle"); + jumping=false; + playerPosition = new Point(playerPosition.x, obstaclepos.y-OBSTACLEHEIGHT); + // if the piranha was up, Hero dies + if (obstacleImages[obstacleImageNo[obstacleno]] != area.obstacle) { + System.out.println("Hero dies!!"); + ingame=false; + + } + /* + else { + // otherwise stop this Piranha + piranhaPopping[obstacleno] = false; + } + */ + } + else { + if (onTheWayUp == false) { + if (playerPosition.y < startPosY) + playerPosition = new Point(playerPosition.x, playerPosition.y+FALLAMOUNT); + else jumping = false; + } + } + } + } + checkIfBlockingObstacle(playerPosition); + //System.out.println("Run: AFTER: Hero's position = (" + playerPosition.x + ", " + playerPosition.y + ")"); + area.repaint(); + } + } + } + + synchronized void incrementObstacleImage(int i) { + obstacleImageNo[i]++; + if (obstacleImageNo[i] == OBSTACLEIMAGES) obstacleImageNo[i] = 0; + } + + synchronized void incrementHeroImage() { + heroImageNo++; + if (heroImageNo == HEROIMAGES) heroImageNo = 0; + } + + Point move(Point start, int direction) { + return(new Point(start.x + direction, start.y)); + } + + boolean deadHero(Point p) { + return(p.x == -1 && p.y ==-1); + } + + public void keyReleased(KeyEvent e) { + boolean needrepaint = false; + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + herocrouching = false; + decKeysDown(DOWNDOWN); + needrepaint = true; + } + /* + else if (e.getKeyCode() == KeyEvent.VK_SPACE) { + decKeysDown(SPACEDOWN); + } + */ + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + decKeysDown(LEFTDOWN); + //superjump = false; + } + else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + decKeysDown(RIGHTDOWN); + //superjump = false; + } + else putWeaponAway(); + //if (needrepaint) area.repaint(); + } + + public void keyTyped(KeyEvent e) { + } + + synchronized Image getHeroImage() { + return(heroImages[heroImageNo]); + } + + synchronized Image getObstacleImage(int obstaclenum) { + return(obstacleImages[obstacleImageNo[obstaclenum]]); + } + + +} + + + diff --git a/Link/bigboss1.1.gif b/Link/bigboss1.1.gif Binary files differ. diff --git a/Link/bigboss1.2.gif b/Link/bigboss1.2.gif Binary files differ. diff --git a/Link/bigboss1.3.gif b/Link/bigboss1.3.gif Binary files differ. diff --git a/Link/blob.gif b/Link/blob.gif Binary files differ. diff --git a/Link/bluegem.gif b/Link/bluegem.gif Binary files differ. diff --git a/Link/boss1.1.gif b/Link/boss1.1.gif Binary files differ. diff --git a/Link/boss1.2.gif b/Link/boss1.2.gif Binary files differ. diff --git a/Link/boss1.3.gif b/Link/boss1.3.gif Binary files differ. diff --git a/Link/gemstand(with gems).gif b/Link/gemstand(with gems).gif Binary files differ. diff --git a/Link/gemstand(without gems).gif b/Link/gemstand(without gems).gif Binary files differ. diff --git a/Link/goldskullata.gif b/Link/goldskullata.gif Binary files differ. diff --git a/Link/greengem.gif b/Link/greengem.gif Binary files differ. diff --git a/Link/link atack left.gif b/Link/link atack left.gif Binary files differ. diff --git a/Link/link atack left2.gif b/Link/link atack left2.gif Binary files differ. diff --git a/Link/link atack right.gif b/Link/link atack right.gif Binary files differ. diff --git a/Link/link atack right2.gif b/Link/link atack right2.gif Binary files differ. diff --git a/Link/link jump left.gif b/Link/link jump left.gif Binary files differ. diff --git a/Link/link jump right.gif b/Link/link jump right.gif Binary files differ. diff --git a/Link/link shield left2.gif b/Link/link shield left2.gif Binary files differ. diff --git a/Link/link shield right2.gif b/Link/link shield right2.gif Binary files differ. diff --git a/Link/link slash left 1.gif b/Link/link slash left 1.gif Binary files differ. diff --git a/Link/link slash left2.gif b/Link/link slash left2.gif Binary files differ. diff --git a/Link/link slash left3.gif b/Link/link slash left3.gif Binary files differ. diff --git a/Link/link slash left4.gif b/Link/link slash left4.gif Binary files differ. diff --git a/Link/link slash left5.gif b/Link/link slash left5.gif Binary files differ. diff --git a/Link/link slash right 1.gif b/Link/link slash right 1.gif Binary files differ. diff --git a/Link/link slash right2.gif b/Link/link slash right2.gif Binary files differ. diff --git a/Link/link slash right3.gif b/Link/link slash right3.gif Binary files differ. diff --git a/Link/link slash right4.gif b/Link/link slash right4.gif Binary files differ. diff --git a/Link/link slash right5.gif b/Link/link slash right5.gif Binary files differ. diff --git a/Link/link.ico b/Link/link.ico Binary files differ. diff --git a/Link/linkcrouchright.gif b/Link/linkcrouchright.gif Binary files differ. diff --git a/Link/linkshieldleft.gif b/Link/linkshieldleft.gif Binary files differ. diff --git a/Link/linkshieldleft2.gif b/Link/linkshieldleft2.gif Binary files differ. diff --git a/Link/linkshieldright.gif b/Link/linkshieldright.gif Binary files differ. diff --git a/Link/linkshieldright2.gif b/Link/linkshieldright2.gif Binary files differ. diff --git a/Link/linkstandleft.gif b/Link/linkstandleft.gif Binary files differ. diff --git a/Link/linkstandleft2.gif b/Link/linkstandleft2.gif Binary files differ. diff --git a/Link/linkstandright.gif b/Link/linkstandright.gif Binary files differ. diff --git a/Link/linkstandright2.gif b/Link/linkstandright2.gif Binary files differ. diff --git a/Link/linksworddown.gif b/Link/linksworddown.gif Binary files differ. diff --git a/Link/linkswordleft.gif b/Link/linkswordleft.gif Binary files differ. diff --git a/Link/linkswordleft2.gif b/Link/linkswordleft2.gif Binary files differ. diff --git a/Link/linkswordright.gif b/Link/linkswordright.gif Binary files differ. diff --git a/Link/linkswordright2.gif b/Link/linkswordright2.gif Binary files differ. diff --git a/Link/madblob.gif b/Link/madblob.gif Binary files differ. diff --git a/Link/metor.gif b/Link/metor.gif Binary files differ. diff --git a/Link/octo.gif b/Link/octo.gif Binary files differ. diff --git a/Link/octopellets.gif b/Link/octopellets.gif Binary files differ. diff --git a/Link/princess Zelda.gif b/Link/princess Zelda.gif Binary files differ. diff --git a/Link/redgem.gif b/Link/redgem.gif Binary files differ. diff --git a/Link/rock.gif b/Link/rock.gif Binary files differ. diff --git a/Link/spider.gif b/Link/spider.gif Binary files differ. diff --git a/Link/yellowgem.gif b/Link/yellowgem.gif Binary files differ. diff --git a/Mario.html b/Mario.html @@ -0,0 +1,8 @@ +<HTML> +<HEAD> +<TITLE>Mario Game</TITLE> +</HEAD> +<BODY> +<APPLET CODE="Mario.MarioGame.class" WIDTH=800 HEIGHT=600 X=200 Y=0></APPLET> +</BODY> +</HTML> diff --git a/Mario/Mario/1up!mushroom.gif b/Mario/Mario/1up!mushroom.gif Binary files differ. diff --git a/Mario/Mario/Atomic Atom1.gif b/Mario/Mario/Atomic Atom1.gif Binary files differ. diff --git a/Mario/Mario/Atomic Atom2.gif b/Mario/Mario/Atomic Atom2.gif Binary files differ. diff --git a/Mario/Mario/Banzai Bill big.gif b/Mario/Mario/Banzai Bill big.gif Binary files differ. diff --git a/Mario/Mario/Banzai Bill small.gif b/Mario/Mario/Banzai Bill small.gif Binary files differ. diff --git a/Mario/Mario/Banzai Bill.gif b/Mario/Mario/Banzai Bill.gif Binary files differ. diff --git a/Mario/Mario/Bowserstandleft.gif b/Mario/Mario/Bowserstandleft.gif Binary files differ. diff --git a/Mario/Mario/Bowserstandright.gif b/Mario/Mario/Bowserstandright.gif Binary files differ. diff --git a/Mario/Mario/Bowserswalkleft2.gif b/Mario/Mario/Bowserswalkleft2.gif Binary files differ. diff --git a/Mario/Mario/Bowserswalkright2.gif b/Mario/Mario/Bowserswalkright2.gif Binary files differ. diff --git a/Mario/Mario/Bowserwalkleft1.gif b/Mario/Mario/Bowserwalkleft1.gif Binary files differ. diff --git a/Mario/Mario/Bowserwalkright1.gif b/Mario/Mario/Bowserwalkright1.gif Binary files differ. diff --git a/Mario/Mario/Bullet Bill.gif b/Mario/Mario/Bullet Bill.gif Binary files differ. diff --git a/Mario/Mario/Chain Chomp Dead!!!.gif b/Mario/Mario/Chain Chomp Dead!!!.gif Binary files differ. diff --git a/Mario/Mario/Chain Chomp!!!.gif b/Mario/Mario/Chain Chomp!!!.gif Binary files differ. diff --git a/Mario/Mario/Chain Chomp2!!!.gif b/Mario/Mario/Chain Chomp2!!!.gif Binary files differ. diff --git a/Mario/Mario/Deadsnowman.gif b/Mario/Mario/Deadsnowman.gif Binary files differ. diff --git a/Mario/Mario/Mario/1up!mushroom.gif b/Mario/Mario/Mario/1up!mushroom.gif Binary files differ. diff --git a/Mario/Mario/Mario/Atomic Atom1.gif b/Mario/Mario/Mario/Atomic Atom1.gif Binary files differ. diff --git a/Mario/Mario/Mario/Atomic Atom2.gif b/Mario/Mario/Mario/Atomic Atom2.gif Binary files differ. diff --git a/Mario/Mario/Mario/Banzai Bill big.gif b/Mario/Mario/Mario/Banzai Bill big.gif Binary files differ. diff --git a/Mario/Mario/Mario/Banzai Bill small.gif b/Mario/Mario/Mario/Banzai Bill small.gif Binary files differ. diff --git a/Mario/Mario/Mario/Banzai Bill.gif b/Mario/Mario/Mario/Banzai Bill.gif Binary files differ. diff --git a/Mario/Mario/Mario/Bowserstandleft.gif b/Mario/Mario/Mario/Bowserstandleft.gif Binary files differ. diff --git a/Mario/Mario/Mario/Bowserstandright.gif b/Mario/Mario/Mario/Bowserstandright.gif Binary files differ. diff --git a/Mario/Mario/Mario/Bowserswalkleft2.gif b/Mario/Mario/Mario/Bowserswalkleft2.gif Binary files differ. diff --git a/Mario/Mario/Mario/Bowserswalkright2.gif b/Mario/Mario/Mario/Bowserswalkright2.gif Binary files differ. diff --git a/Mario/Mario/Mario/Bowserwalkleft1.gif b/Mario/Mario/Mario/Bowserwalkleft1.gif Binary files differ. diff --git a/Mario/Mario/Mario/Bowserwalkright1.gif b/Mario/Mario/Mario/Bowserwalkright1.gif Binary files differ. diff --git a/Mario/Mario/Mario/Bullet Bill.gif b/Mario/Mario/Mario/Bullet Bill.gif Binary files differ. diff --git a/Mario/Mario/Mario/Chain Chomp Dead!!!.gif b/Mario/Mario/Mario/Chain Chomp Dead!!!.gif Binary files differ. diff --git a/Mario/Mario/Mario/Chain Chomp!!!.gif b/Mario/Mario/Mario/Chain Chomp!!!.gif Binary files differ. diff --git a/Mario/Mario/Mario/Chain Chomp2!!!.gif b/Mario/Mario/Mario/Chain Chomp2!!!.gif Binary files differ. diff --git a/Mario/Mario/Mario/Deadsnowman.gif b/Mario/Mario/Mario/Deadsnowman.gif Binary files differ. diff --git a/Mario/Mario/Mario/Robot.gif b/Mario/Mario/Mario/Robot.gif Binary files differ. diff --git a/Mario/Mario/Mario/Snowman.gif b/Mario/Mario/Mario/Snowman.gif Binary files differ. diff --git a/Mario/Mario/Mario/Wigler1.5Left.gif b/Mario/Mario/Mario/Wigler1.5Left.gif Binary files differ. diff --git a/Mario/Mario/Mario/Wigler1.5Right.gif b/Mario/Mario/Mario/Wigler1.5Right.gif Binary files differ. diff --git a/Mario/Mario/Mario/Wigler1Left.gif b/Mario/Mario/Mario/Wigler1Left.gif Binary files differ. diff --git a/Mario/Mario/Mario/Wigler1Right.gif b/Mario/Mario/Mario/Wigler1Right.gif Binary files differ. diff --git a/Mario/Mario/Mario/Wigler2Left.gif b/Mario/Mario/Mario/Wigler2Left.gif Binary files differ. diff --git a/Mario/Mario/Mario/Wigler2Right.gif b/Mario/Mario/Mario/Wigler2Right.gif Binary files differ. diff --git a/Mario/Mario/Mario/bobomb.gif b/Mario/Mario/Mario/bobomb.gif Binary files differ. diff --git a/Mario/Mario/Mario/bobomb2.gif b/Mario/Mario/Mario/bobomb2.gif Binary files differ. diff --git a/Mario/Mario/Mario/bobombbang1.gif b/Mario/Mario/Mario/bobombbang1.gif Binary files differ. diff --git a/Mario/Mario/Mario/bobombbang2.gif b/Mario/Mario/Mario/bobombbang2.gif Binary files differ. diff --git a/Mario/Mario/Mario/bobombf2.gif b/Mario/Mario/Mario/bobombf2.gif Binary files differ. diff --git a/Mario/Mario/Mario/bobombr.gif b/Mario/Mario/Mario/bobombr.gif Binary files differ. diff --git a/Mario/Mario/Mario/boo1.gif b/Mario/Mario/Mario/boo1.gif Binary files differ. diff --git a/Mario/Mario/Mario/boo2.gif b/Mario/Mario/Mario/boo2.gif Binary files differ. diff --git a/Mario/Mario/Mario/cannon.gif b/Mario/Mario/Mario/cannon.gif Binary files differ. diff --git a/Mario/Mario/Mario/cool cube.gif b/Mario/Mario/Mario/cool cube.gif Binary files differ. diff --git a/Mario/Mario/Mario/cube.gif b/Mario/Mario/Mario/cube.gif Binary files differ. diff --git a/Mario/Mario/Mario/fireboo1.gif b/Mario/Mario/Mario/fireboo1.gif Binary files differ. diff --git a/Mario/Mario/Mario/fireboo2.gif b/Mario/Mario/Mario/fireboo2.gif Binary files differ. diff --git a/Mario/Mario/Mario/goomba.gif b/Mario/Mario/Mario/goomba.gif Binary files differ. diff --git a/Mario/Mario/Mario/goomba2.gif b/Mario/Mario/Mario/goomba2.gif Binary files differ. diff --git a/Mario/Mario/Mario/goombaleft.gif b/Mario/Mario/Mario/goombaleft.gif Binary files differ. diff --git a/Mario/Mario/Mario/goombaleft2.gif b/Mario/Mario/Mario/goombaleft2.gif Binary files differ. diff --git a/Mario/Mario/Mario/goombasquished.gif b/Mario/Mario/Mario/goombasquished.gif Binary files differ. diff --git a/Mario/Mario/Mario/koopaparatroopa1.gif b/Mario/Mario/Mario/koopaparatroopa1.gif Binary files differ. diff --git a/Mario/Mario/Mario/koopaparatroopa1left.gif b/Mario/Mario/Mario/koopaparatroopa1left.gif Binary files differ. diff --git a/Mario/Mario/Mario/koopaparatroopa2.gif b/Mario/Mario/Mario/koopaparatroopa2.gif Binary files differ. diff --git a/Mario/Mario/Mario/koopaparatroopa2left.gif b/Mario/Mario/Mario/koopaparatroopa2left.gif Binary files differ. diff --git a/Mario/Mario/Mario/koopaparatroopashell.gif b/Mario/Mario/Mario/koopaparatroopashell.gif Binary files differ. diff --git a/Mario/Mario/Mario/koopatroopa.gif b/Mario/Mario/Mario/koopatroopa.gif Binary files differ. diff --git a/Mario/Mario/Mario/koopatroopaleft.gif b/Mario/Mario/Mario/koopatroopaleft.gif Binary files differ. diff --git a/Mario/Mario/Mario/koopatroopashell.gif b/Mario/Mario/Mario/koopatroopashell.gif Binary files differ. diff --git a/Mario/Mario/Mario/luigi1.gif b/Mario/Mario/Mario/luigi1.gif Binary files differ. diff --git a/Mario/Mario/Mario/luigi1left.gif b/Mario/Mario/Mario/luigi1left.gif Binary files differ. diff --git a/Mario/Mario/Mario/luigi2.gif b/Mario/Mario/Mario/luigi2.gif Binary files differ. diff --git a/Mario/Mario/Mario/luigi2left.gif b/Mario/Mario/Mario/luigi2left.gif Binary files differ. diff --git a/Mario/Mario/Mario/luigicrouch.gif b/Mario/Mario/Mario/luigicrouch.gif Binary files differ. diff --git a/Mario/Mario/Mario/luigicrouchleft.gif b/Mario/Mario/Mario/luigicrouchleft.gif Binary files differ. diff --git a/Mario/Mario/Mario/luigijump.gif b/Mario/Mario/Mario/luigijump.gif Binary files differ. diff --git a/Mario/Mario/Mario/luigijumpleft.gif b/Mario/Mario/Mario/luigijumpleft.gif Binary files differ. diff --git a/Mario/Mario/Mario/luigistand.gif b/Mario/Mario/Mario/luigistand.gif Binary files differ. diff --git a/Mario/Mario/Mario/luigistandleft.gif b/Mario/Mario/Mario/luigistandleft.gif Binary files differ. diff --git a/Mario/Mario/Mario/mario.ico b/Mario/Mario/Mario/mario.ico Binary files differ. diff --git a/Mario/Mario/Mario/mario1.gif b/Mario/Mario/Mario/mario1.gif Binary files differ. diff --git a/Mario/Mario/Mario/mario1left.gif b/Mario/Mario/Mario/mario1left.gif Binary files differ. diff --git a/Mario/Mario/Mario/mario2.gif b/Mario/Mario/Mario/mario2.gif Binary files differ. diff --git a/Mario/Mario/Mario/mario2left.gif b/Mario/Mario/Mario/mario2left.gif Binary files differ. diff --git a/Mario/Mario/Mario/marioblo.gif b/Mario/Mario/Mario/marioblo.gif Binary files differ. diff --git a/Mario/Mario/Mario/marioblock.gif b/Mario/Mario/Mario/marioblock.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariobox.gif b/Mario/Mario/Mario/mariobox.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariocoin1.gif b/Mario/Mario/Mario/mariocoin1.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariocoin2.gif b/Mario/Mario/Mario/mariocoin2.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariocoin3.gif b/Mario/Mario/Mario/mariocoin3.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariocrouch.gif b/Mario/Mario/Mario/mariocrouch.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariocrouchleft.gif b/Mario/Mario/Mario/mariocrouchleft.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariodead.gif b/Mario/Mario/Mario/mariodead.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariofloor.gif b/Mario/Mario/Mario/mariofloor.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariofloor10.gif b/Mario/Mario/Mario/mariofloor10.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariofloor2.gif b/Mario/Mario/Mario/mariofloor2.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariofloor3.gif b/Mario/Mario/Mario/mariofloor3.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariofloor4.gif b/Mario/Mario/Mario/mariofloor4.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariofloor5.gif b/Mario/Mario/Mario/mariofloor5.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariofloor6.gif b/Mario/Mario/Mario/mariofloor6.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariofloor7.gif b/Mario/Mario/Mario/mariofloor7.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariofloor8.gif b/Mario/Mario/Mario/mariofloor8.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariofloor9.gif b/Mario/Mario/Mario/mariofloor9.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariograss.gif b/Mario/Mario/Mario/mariograss.gif Binary files differ. diff --git a/Mario/Mario/Mario/marioicon.gif b/Mario/Mario/Mario/marioicon.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariojump.gif b/Mario/Mario/Mario/mariojump.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariojumpleft.gif b/Mario/Mario/Mario/mariojumpleft.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariometalbox.gif b/Mario/Mario/Mario/mariometalbox.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariopipe.gif b/Mario/Mario/Mario/mariopipe.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariopipe2.gif b/Mario/Mario/Mario/mariopipe2.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariostand.gif b/Mario/Mario/Mario/mariostand.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariostandleft.gif b/Mario/Mario/Mario/mariostandleft.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariotitle.gif b/Mario/Mario/Mario/mariotitle.gif Binary files differ. diff --git a/Mario/Mario/Mario/mariowarp.gif b/Mario/Mario/Mario/mariowarp.gif Binary files differ. diff --git a/Mario/Mario/Mario/missioncomplete.gif b/Mario/Mario/Mario/missioncomplete.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaflying1.gif b/Mario/Mario/Mario/piranhaflying1.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaflying2.gif b/Mario/Mario/Mario/piranhaflying2.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplant1.gif b/Mario/Mario/Mario/piranhaplant1.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplant1huge.gif b/Mario/Mario/Mario/piranhaplant1huge.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplant2.gif b/Mario/Mario/Mario/piranhaplant2.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplant2huge.gif b/Mario/Mario/Mario/piranhaplant2huge.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplantboss.gif b/Mario/Mario/Mario/piranhaplantboss.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplantboss2.gif b/Mario/Mario/Mario/piranhaplantboss2.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplantbossA.gif b/Mario/Mario/Mario/piranhaplantbossA.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplantbossB.gif b/Mario/Mario/Mario/piranhaplantbossB.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplantbossC.gif b/Mario/Mario/Mario/piranhaplantbossC.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplantbossD.gif b/Mario/Mario/Mario/piranhaplantbossD.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplantbossE.gif b/Mario/Mario/Mario/piranhaplantbossE.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplantbossf.gif b/Mario/Mario/Mario/piranhaplantbossf.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplanthugepeep.gif b/Mario/Mario/Mario/piranhaplanthugepeep.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplanthugepeepo.gif b/Mario/Mario/Mario/piranhaplanthugepeepo.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranhaplanthugepeepy.gif b/Mario/Mario/Mario/piranhaplanthugepeepy.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranharightflying1.gif b/Mario/Mario/Mario/piranharightflying1.gif Binary files differ. diff --git a/Mario/Mario/Mario/piranharightflying2.gif b/Mario/Mario/Mario/piranharightflying2.gif Binary files differ. diff --git a/Mario/Mario/Mario/poisonmushroom.gif b/Mario/Mario/Mario/poisonmushroom.gif Binary files differ. diff --git a/Mario/Mario/Mario/supaturtle.gif b/Mario/Mario/Mario/supaturtle.gif Binary files differ. diff --git a/Mario/Mario/Mario/super cannon.gif b/Mario/Mario/Mario/super cannon.gif Binary files differ. diff --git a/Mario/Mario/Mario/warship1.gif b/Mario/Mario/Mario/warship1.gif Binary files differ. diff --git a/Mario/Mario/Mario/warship2.gif b/Mario/Mario/Mario/warship2.gif Binary files differ. diff --git a/Mario/Mario/Mario/yes.bmp b/Mario/Mario/Mario/yes.bmp Binary files differ. diff --git a/Mario/Mario/Mario/yetileft1.gif b/Mario/Mario/Mario/yetileft1.gif Binary files differ. diff --git a/Mario/Mario/Mario/yetileft2.gif b/Mario/Mario/Mario/yetileft2.gif Binary files differ. diff --git a/Mario/Mario/Mario/yetiright1.gif b/Mario/Mario/Mario/yetiright1.gif Binary files differ. diff --git a/Mario/Mario/Mario/yetiright2.gif b/Mario/Mario/Mario/yetiright2.gif Binary files differ. diff --git a/Mario/Mario/MarioArea.java b/Mario/Mario/MarioArea.java @@ -0,0 +1,305 @@ +package Mario; + +import java.awt.*; + +public class MarioArea extends Panel { + + static int FLOORLEVEL = 589; + static final int FLOORWIDTH = 150; + static int FLOORDIFF = 605-FLOORLEVEL; + MarioGame myApplet = null; + Image mariotitle; + Image icefloor; + Image floor2; + Image floor3; + Image floor4; + Image floor5; + Image floor6; + Image floor7; + Image floor8; + Image floor9; + Image mariograss; + Image upmushroom; + Image goomba; + Image goombaleft; + Image goomba2; + Image goomba2left; + Image kooparedf; + Image koopared; + Image redshell; + Image kooparedfleft; + Image kooparedleft; + Image koopagreen; + Image koopagreenleft; + Image greenshell; + Image hero1; + Image hero1left; + Image hero2; + Image hero2left; + Image herocrouch; + Image herocrouchleft; + Image herojump; + Image herojumpleft; + Image obstacle; + Image tallobstacle; + Image herostand; + Image herostandleft; + Image piranha1; + Image piranha2; + Image piranhapeep; + Image piranhapeepo; + Image piranhapeepy; + Image poison; + Image Luigi1; + Image Luigi1left; + Image Luigi2; + Image Luigi2left; + Image Luigicrouch; + Image Luigiccrouchleft; + Image Luigijump; + Image Luigijumpleft; + Image Luigistand; + Image Luigistandleft; + Image herowarp; + Image levelcomplete; + Image herodead; + Image squishedgoomba; + Image Banzai; + Image Bullet; + Image Wiglerleft; + Image Wiglerright; + Image Wiglerleft2; + Image Wiglerright2; + Image Wiglerleft1; + Image Wiglerright1; + Image Boo1; + Image Boo2; + Image Fireboo1; + Image Fireboo2; + Image Bobomb; + Image Bobomb2; + Image Bobombf; + Image Bobombf2; + Image Warship1; + Image Warship2; + Image Yetil1; + Image Yetil2; + Image Yetir1; + Image Yetir2; + Image p1fl; + Image p2fl; + Image p1fr; + Image p2fr; + Image cube; + Image robot; + Image chainchomp1; + Image chainchomp2; + Image chainchompdead; + Image Atom1; + Image Atom2; + Image Floor10; + MediaTracker mt=null; + boolean showingMessage = false; + + public MarioArea(MarioGame parent) { + mt=new MediaTracker(parent); + myApplet = parent; + upmushroom = load(parent, "1up!mushroom.gif"); + goomba = load(parent, "goomba.gif"); + goombaleft = load(parent, "goombaleft.gif"); + goomba2 = load(parent, "goomba2.gif"); + goomba2left = load(parent, "goombaleft2.gif"); + squishedgoomba = load(parent, "goombasquished.gif"); + + kooparedf = load(parent, "koopaparatroopa1.gif"); + koopared = load(parent, "koopaparatroopa2.gif"); + redshell = load(parent, "koopaparatroopashell.gif"); + + kooparedfleft = load(parent, "koopaparatroopa1left.gif"); + kooparedleft = load(parent, "koopaparatroopa2left.gif"); + koopagreenleft = load(parent, "koopatroopa.gif"); + + koopagreen = load(parent, "koopatroopaleft.gif"); + greenshell = load(parent, "koopatroopashell.gif"); + + hero1 = load(parent, "mario1.gif"); + hero1left = load(parent, "mario1left.gif"); + hero2 = load(parent, "mario2.gif"); + hero2left = load(parent, "mario2left.gif"); + herocrouch = load(parent, "mariocrouch.gif"); + herocrouchleft = load(parent, "mariocrouchleft.gif"); + herojump = load(parent, "mariojump.gif"); + herojumpleft = load(parent, "mariojumpleft.gif"); + obstacle = load(parent, "mariopipe.gif"); + tallobstacle = load(parent, "mariopipe2.gif"); + herostand = load(parent, "mariostand.gif"); + herostandleft = load(parent, "mariostandleft.gif"); + + piranhapeep = load(parent, "piranhaplanthugepeep.gif"); + piranhapeepo = load(parent, "piranhaplanthugepeepo.gif"); + piranhapeepy = load(parent, "piranhaplanthugepeepy.gif"); + + piranha1 = load(parent, "piranhaplant1huge.gif"); + piranha2 = load(parent, "piranhaplant2huge.gif"); + + poison = load(parent, "poisonmushroom.gif"); + herowarp = load(parent, "mariowarp.gif"); + icefloor = load(parent, "mariofloor.gif"); + floor2 = load(parent, "mariofloor2.gif"); + floor3 = load(parent, "mariofloor3.gif"); + floor4 = load(parent, "mariofloor4.gif"); + floor5 = load(parent, "mariofloor5.gif"); + floor6 = load(parent, "mariofloor6.gif"); + floor7 = load(parent, "mariofloor7.gif"); + floor8 = load(parent, "mariofloor8.gif"); + floor9 = load(parent, "mariofloor9.gif"); + mariograss = load(parent, "mariograss.gif"); + p1fl = load(parent, "piranhaflying1.gif"); + p2fl = load(parent, "piranhaflying2.gif"); + p1fr = load(parent, "piranharightflying1.gif"); + p2fr = load(parent, "piranharightflying2.gif"); + + + levelcomplete = load(parent, "missioncomplete.gif"); + herodead = load(parent, "mariodead.gif"); + + Banzai = load(parent, "Banzai Bill.gif"); + Bullet = load(parent, "Bullet Bill.gif"); + + Wiglerleft = load(parent, "Wigler1Left.gif"); + Wiglerright = load(parent, "Wigler1Right.gif"); + + Wiglerleft2 = load(parent, "Wigler2Left.gif"); + Wiglerright2 = load(parent, "Wigler2Right.gif"); + + Wiglerleft1 = load(parent, "Wigler1.5Left.gif"); + Wiglerright1 = load(parent, "Wigler1.5Right.gif"); + + Boo1 = load(parent, "boo1.gif"); + Boo2 = load(parent, "boo2.gif"); + Fireboo1 = load(parent, "fireboo1.gif"); + Fireboo2 = load(parent, "fireboo2.gif"); + Bobomb = load(parent, "bobomb.gif"); + Bobomb2 = load(parent, "bobomb2.gif"); + Bobombf = load(parent, "bobombr.gif"); + Bobombf2 = load(parent, "bobombf2.gif"); + Warship1 = load(parent, "warship1.gif"); + Warship2 = load(parent, "warship2.gif"); + + Yetil1 = load(parent, "yetileft1.gif"); + Yetil2 = load(parent, "yetileft2.gif"); + Yetir1 = load(parent, "yetiright1.gif"); + Yetir2 = load(parent, "yetiright2.gif"); + mariotitle = load(parent, "mariotitle.gif"); + cube = load(parent, "cube.gif"); + chainchomp1 = load(parent, "Chain Chomp!!!.gif"); + chainchomp2 = load(parent, "Chain Chomp2!!!.gif"); + robot = load(parent, "Robot.gif"); + chainchompdead = load(parent, "Chain Chomp Dead!!!.gif"); + + Atom1 = load(parent, "Atomic Atom1.gif"); + Atom2 = load(parent, "Atomic Atom2.gif"); + + Floor10 = load(parent, "mariofloor10.gif"); + } + Image load(MarioGame parent, String picture) { + Image im = parent.getImage(myApplet.getCodeBase(), "Mario\\" + picture); + checkImage(im, picture); + return(im); + } + + void checkImage(Image image, String name) { + if (mt != null) { + mt.addImage(image,0); + try { + mt.waitForID(0,5000); + } + catch (InterruptedException ie) { + // nothing to do + } + if (mt.isErrorID(0)) System.out.println("Image Not found: "+name.toString()); + } + } + + public synchronized void paint (Graphics g) { + Image obstacleimage, enemyimage; + if (myApplet == null || Fireboo2 == null) return; + final int w = getBounds().width; + final int h = getBounds().height; + g.setColor(Color.white); + g.fillRect(0, 0, w, FLOORLEVEL); // don't white wash the floor! + FontMetrics fm = getFontMetrics(getFont()); + + g.setColor(Color.black); + int asc = fm.getAscent() + 4; + + // paint the floor + if (myApplet.floors[myApplet.level-1] != null) { + for (int pos=0; pos < w; pos+=FLOORWIDTH) { + g.drawImage(myApplet.floors[myApplet.level-1],pos, FLOORLEVEL,Color.black, null); + } + } + if (!myApplet.juststarted) { + if (myApplet.obstaclePositions != null) { + myApplet.changePageIfNecessary(); + // show the obstacles from right to left (because pipes have white space to their left but not their right) + for (int i=myApplet.obstacleNumber-1; i >= 0; i--) { + obstacleimage = myApplet.getObstacleImage(i); + if (myApplet.isTall[i]) obstacleimage = tallobstacle; // only one image for this for now + g.drawImage(obstacleimage, myApplet.obstaclePositions[i].x-(myApplet.page*myApplet.PAGEWIDTH), myApplet.obstaclePositions[i].y,Color.white, null); + } + } + + // show the enemies + if (myApplet.enemyPositions != null) { + for (int i=0; i < myApplet.enemyNumber; i++) { + //if (!myApplet.enemyDead[i]) { + enemyimage = myApplet.getEnemyImage(i); + g.drawImage(enemyimage, myApplet.enemyPositions[i].x-(myApplet.page*myApplet.PAGEWIDTH), myApplet.enemyPositions[i].y,null); + //} + } + } + + // draw Hero (on top of preceding images) + if (myApplet.playerPosition != null) { + // show the player + Image herosimage = myApplet.getHeroImage(); + if (myApplet.herocrouching) { + if (myApplet.heroleft) + herosimage = herocrouchleft; + else + herosimage = herocrouch; + } + if (myApplet.jumping) { + if (myApplet.heroleft) + herosimage = herojumpleft; + else + herosimage = herojump; + } + g.drawImage(herosimage, myApplet.playerPosition.x-(myApplet.page*myApplet.PAGEWIDTH), myApplet.playerPosition.y,/*Color.white,*/ null); + } + } + + // draw warp image (on top of Hero) + if (myApplet.warpzone != null) { + // show the warp zone at the end of the level + g.drawImage(herowarp, myApplet.warpzone.x-(myApplet.page*myApplet.PAGEWIDTH), myApplet.warpzone.y,Color.white, null); + } + + if (myApplet.ingame == false && !myApplet.juststarted) { + if (myApplet.dead) { + // Hero is dead + g.drawImage(herodead, myApplet.getBounds().width/2, getBounds().height/2,Color.white, null); + } + else { + // level complete + g.drawImage(levelcomplete, myApplet.getBounds().width/2, getBounds().height/2,Color.white, null); + } + showingMessage=true; + } + else + showingMessage = false; + + myApplet.setSomethingChangedSinceRepaint(false); + } +}+ \ No newline at end of file diff --git a/Mario/Mario/MarioFrame.java b/Mario/Mario/MarioFrame.java @@ -0,0 +1,10 @@ +package Mario; + +import java.awt.Frame; + +public class MarioFrame extends Frame { + + public MarioFrame() { + setBounds(200, 200, 200, 150); + } +}+ \ No newline at end of file diff --git a/Mario/Mario/MarioGame.java b/Mario/Mario/MarioGame.java @@ -0,0 +1,1518 @@ +/* Copyright (c) Mary Percival 2003 */ +/* Mario game Created May 2003 */ + +package Mario; + +import java.awt.*; +import java.awt.event.*; +import java.applet.*; + +public class MarioGame extends Applet implements KeyListener, Runnable { + + boolean easymode = true; + static int MAXLEVEL = 9; + static int level = 1; + + // the levels so far are: + // 1 beginner level: 1 piranha & 1 goomba + // 2 introducing green koopa + // 3 more of the same + // 4 introducing red koopa (flying) + // 5 more and harder + // 6 ? + // 7 ? + // 8 ? + // 9 ? + + static int LEFT=1; + static int RIGHT=0; + // the next 2 constants are overridden in init once we know the screen size + static int RIGHTEDGE = 789; + static int BOTTOMEDGE = 900; + static int PAGEWIDTH=741; + + static Point IMAGESIZE=new Point(152,107); + static final int LEFTEDGE = -45; + static final int TOPEDGE = -10; + static int GROUNDLEVEL = 503; + static int startPosY; + static int JUMPAMOUNT=90; + static int BOUNCEAMOUNT=90; + static final int FALLAMOUNT=16; // amount he falls each time interval + static final int RISEAMOUNT=16; // amount he rises each time interval + static final int XAMOUNT=12; + + static final int X = 1; + static final int Y = 2; + static final int NOT=3; + static final int DELAY = 50; + + static final int OBSTACLEIMAGES = 19; + static final int HEROIMAGES = 4; + static final int ENEMYIMAGES=3; + + // ---------------------------------------------------------------------------------------------- + // ENEMY TYPES + // ---------------------------------------------------------------------------------------------- + static final int ENEMYTYPES=15; // goomba, koopa red, koopa green, koopa red flying, banzai, wiggler, boo, fireboo,bobomb,warship,yeti,chainchomp,atom + static final int GOOMBA=0; + static final int KOOPARED =1; + static final int KOOPAGREEN=2; + static final int KOOPAREDFLYING=3; + static final int BANZAI=4; + static final int WIGGLER=5; + static final int BOO=6; + static final int FIREBOO=7; + static final int BOBOMB=8; + static final int BULLET=9; + static final int WARSHIP=10; + static final int YETI=11; + static final int FLYER=12; + static final int CHOMP=13; + static final int ATOM=14; + + + + // enemy positions (height) + static final int GOOMBAHEIGHT =GROUNDLEVEL+55; + static final int KOOPAREDHEIGHT =GROUNDLEVEL+39; + static final int KOOPAGREENHEIGHT =GROUNDLEVEL+39; + static final int KOOPAREDFLYINGHEIGHT=GROUNDLEVEL-16; + static final int BANZAIHEIGHT =GROUNDLEVEL-90; + static final int WIGGLERHEIGHT =GROUNDLEVEL+16; + static final int BOOHEIGHT =GROUNDLEVEL-7; + static final int FIREBOOHEIGHT =GROUNDLEVEL-7; + static final int BOBOMBHEIGHT =GROUNDLEVEL+5; + static final int BULLETHEIGHT =GROUNDLEVEL+55; + static final int WARSHIPHEIGHT =GROUNDLEVEL+100; + static final int YETIHEIGHT =GROUNDLEVEL; + static final int FLYERHEIGHT =GROUNDLEVEL-20; + static final int CHOMPHEIGHT =GROUNDLEVEL-55; + static final int ATOMHEIGHT =GROUNDLEVEL+40; + static int enemyHeight[] = new int[ENEMYTYPES]; + + static final int enemySize[] = {27, 42, 42, 42, 172, 75, 37, 37, 74, 8, 152, 86, 86, 75, 25}; + static final int enemyTopSpace[] = { 4, 13, 13, 0, 0, 10, 6, 6, 7, 0, 20, 8, 17, 10, 0}; + + static final int SPACE_FROM_X_TO_MARIO=55; + static final int MARIOHEIGHT=86; + static final int MARIOOFFSET=21; + static final int MARIOCROUCHOFFSET=39; + static final int MARIOSTANDINGSIZE = 65; + static final int MARIOCROUCHINGSIZE = 45; + + static final int JUMPDURATION=5; + static final int SUPERJUMPDURATION=8; + static final int MARIOLEFTOFOBSTACLE = 45; // fudge factor because Mario image is diff size to obstacle image + static final int MARIORIGHTOFOBSTACLE = 10; // fudge factor because Mario image is diff size to obstacle image + static final int ENEMYLEFTOFOBSTACLE = 16; // fudge factor for enemy images + static final int ENEMYRIGHTOFOBSTACLE = 49; // >49 causes panic! + static final int MARIOLEFTOFENEMY=73; + static final int MARIORIGHTOFENEMY=-23; + + static final int LEFTDOWN=0; + static final int RIGHTDOWN=1; + static final int DOWNDOWN=2; + static final int SPACEDOWN=3; + + static final int OBSTACLEHEIGHT=42; + static final int TALLOBSTACLEDIFF=28; + static final int OBSTACLEWIDTH=86; + int GROUNDDIFF=605-GROUNDLEVEL; + + // all member variables 'static' because shared with the enemy action thread + static MarioArea area; + Thread timer; + static boolean finished = false; + static boolean ingame = false; + static boolean juststarted = true; + static Point warpzone; + static int[] keysdown = new int[4]; + static Point[] enemyPositions; + static Point playerPosition; + static Point[] obstaclePositions; + static boolean[] piranhaPopping; // one for each obstacle + static boolean[] hasPiranha; // one for each obstacle + static boolean[] isTall; // one for each obstacle + static int enemyDirection[]; + static int enemyNumber=1, enemiesRemaining=1, obstacleNumber=1; + static boolean herocrouching = false; + static boolean onTheWayUp=false; + static boolean bouncing=false; + static boolean wasbouncing = false; + static boolean dead = false; + static int page = 0; + static int heroImageNo = 0; + static int enemyImageNo[]; + static int levellength=1482; + static Image[] heroImages = new Image[HEROIMAGES]; + static Image[] obstacleImages = new Image[OBSTACLEIMAGES]; // pipe, piranhapeep, piranha peepy etc + static Image[] squished = new Image[ENEMYTYPES]; // squished images for each enemy type + static Image[][][] enemyImages = new Image[ENEMYTYPES][2][ENEMYIMAGES]; // left right left right or whatever + static int obstacleImageNo[]; // what is the current image for obstacle n + static Image[][] enemyImage = new Image[ENEMYTYPES][ENEMYIMAGES];// what is the current image for enemy n? + static Image floors[] = new Image[MAXLEVEL]; + static int enemyType[]; // what is the type of enemy n? + static boolean enemyDead[]; // is enemy n dead? + static boolean heroleft = false; + static boolean jumping = false; + static int enemyMove[] = new int[ENEMYTYPES]; + boolean somethingChangedSinceRepaint=false; + + // ************************************************************* + public void init() { + + setLayout(null); + setBackground(Color.white); + + area = new MarioArea(this); + add(area); + FontMetrics fm = getFontMetrics(getFont()); + RIGHTEDGE = (getBounds().width/XAMOUNT)*XAMOUNT +LEFTEDGE; + BOTTOMEDGE = getBounds().height - 1; + setVisible(true); + area.setBounds(0,0,getBounds().width,BOTTOMEDGE); + GROUNDLEVEL = getBounds().height-GROUNDDIFF; + startPosY = GROUNDLEVEL; + area.FLOORLEVEL = getBounds().height-area.FLOORDIFF; + area.setVisible(true); + + addKeyListener(this); + area.addKeyListener(this); + area.requestFocus(); + + obstacleImages[0] = area.obstacle; + obstacleImages[1] = area.obstacle; + obstacleImages[2] = area.obstacle; + obstacleImages[3] = area.obstacle; + obstacleImages[4] = area.piranhapeepo; + obstacleImages[5] = area.piranhapeep; + obstacleImages[6] = area.piranhapeepy; + obstacleImages[7] = area.piranha1; + obstacleImages[8] = area.piranha1; + obstacleImages[9] = area.piranha1; + obstacleImages[10] = area.piranha2; // + obstacleImages[11] = area.piranha2; // + obstacleImages[12] = area.piranha2; // + obstacleImages[13] = area.piranhapeepy; // + obstacleImages[14] = area.piranhapeep; // + obstacleImages[15] = area.piranhapeepo; + obstacleImages[16] = area.obstacle; // + obstacleImages[17] = area.obstacle; // + obstacleImages[18] = area.obstacle; // + + enemyImages[GOOMBA][RIGHT][0] = area.goomba; + enemyImages[GOOMBA][RIGHT][1] = area.goomba2; + enemyImages[GOOMBA][LEFT][0] = area.goombaleft; + enemyImages[GOOMBA][LEFT][1] = area.goomba2left; + + enemyImages[KOOPARED][RIGHT][0] = area.kooparedleft; + enemyImages[KOOPARED][RIGHT][1] = area.kooparedleft; + enemyImages[KOOPARED][LEFT][0] = area.koopared; + enemyImages[KOOPARED][LEFT][1] = area.koopared; + + enemyImages[KOOPAGREEN][RIGHT][0] = area.koopagreen; + enemyImages[KOOPAGREEN][RIGHT][1] = area.koopagreen; + enemyImages[KOOPAGREEN][LEFT][0] = area.koopagreenleft; + enemyImages[KOOPAGREEN][LEFT][1] = area.koopagreenleft; + + enemyImages[KOOPAREDFLYING][RIGHT][0] = area.kooparedfleft; + enemyImages[KOOPAREDFLYING][RIGHT][1] = area.kooparedfleft; + enemyImages[KOOPAREDFLYING][LEFT][0] = area.kooparedf; + enemyImages[KOOPAREDFLYING][LEFT][1] = area.kooparedf; + + enemyImages[BANZAI][RIGHT][0] = area.Banzai; + enemyImages[BANZAI][RIGHT][1] = area.Banzai; + enemyImages[BANZAI][LEFT][0] = area.Banzai; + enemyImages[BANZAI][LEFT][1] = area.Banzai; + + enemyImages[WIGGLER][RIGHT][0] = area.Wiglerright; + enemyImages[WIGGLER][RIGHT][1] = area.Wiglerright1; + enemyImages[WIGGLER][RIGHT][2] = area.Wiglerright2; + enemyImages[WIGGLER][LEFT][0] = area.Wiglerleft; + enemyImages[WIGGLER][LEFT][1] = area.Wiglerleft1; + enemyImages[WIGGLER][LEFT][2] = area.Wiglerleft2; + + enemyImages[BOO][RIGHT][0] =area.Boo2; + enemyImages[BOO][RIGHT][1] =area.Boo2; + enemyImages[BOO][LEFT][0] =area.Boo1; + enemyImages[BOO][LEFT][1] =area.Boo1; + + enemyImages[FIREBOO][RIGHT][0] =area.Fireboo2; + enemyImages[FIREBOO][RIGHT][1] =area.Fireboo2; + enemyImages[FIREBOO][LEFT][0] =area.Fireboo1; + enemyImages[FIREBOO][LEFT][1] =area.Fireboo1; + + enemyImages[BOBOMB][LEFT][0] =area.Bobomb; + enemyImages[BOBOMB][LEFT][1] =area.Bobomb2; + enemyImages[BOBOMB][RIGHT][0] =area.Bobombf; + enemyImages[BOBOMB][RIGHT][1] =area.Bobombf2; + + enemyImages[BULLET][LEFT][0] =area.Bullet; + enemyImages[BULLET][LEFT][1] =area.Bullet; + enemyImages[BULLET][RIGHT][0] =area.Bullet; + enemyImages[BULLET][RIGHT][1] =area.Bullet; + + enemyImages[WARSHIP][LEFT][0] =area.Warship1; + enemyImages[WARSHIP][LEFT][1] =area.Warship2; + enemyImages[WARSHIP][RIGHT][0] =area.Warship1; + enemyImages[WARSHIP][RIGHT][1] =area.Warship2; + + enemyImages[YETI][LEFT][0] =area.Yetil1; + enemyImages[YETI][LEFT][1] =area.Yetil2; + enemyImages[YETI][RIGHT][0] =area.Yetir1; + enemyImages[YETI][RIGHT][1] =area.Yetir2; + + enemyImages[FLYER][LEFT][0] =area.p1fl; + enemyImages[FLYER][LEFT][1] =area.p2fl; + enemyImages[FLYER][RIGHT][0] =area.p1fr; + enemyImages[FLYER][RIGHT][1] =area.p2fr; + + enemyImages[CHOMP][LEFT][0] =area.chainchomp1; + enemyImages[CHOMP][LEFT][1] =area.chainchomp2; + enemyImages[CHOMP][RIGHT][0] =area.chainchomp1; + enemyImages[CHOMP][RIGHT][1] =area.chainchomp2; + + enemyImages[ATOM][LEFT][0] =area.Atom1; + enemyImages[ATOM][LEFT][1] =area.Atom2; + enemyImages[ATOM][RIGHT][0] =area.Atom1; + enemyImages[ATOM][RIGHT][1] =area.Atom2; + + enemyMove[GOOMBA] = 5; + enemyMove[KOOPARED] = 5; + enemyMove[KOOPAGREEN] = 5; + enemyMove[KOOPAREDFLYING] = 8; + enemyMove[BANZAI] = 16; + enemyMove[WIGGLER] = 15; + enemyMove[BOO] = 5; + enemyMove[FIREBOO] = 10; + enemyMove[BOBOMB] = 5; + enemyMove[BULLET] = 10; + enemyMove[WARSHIP] = 20; + enemyMove[YETI] = 5; + enemyMove[FLYER] = 10; + enemyMove[CHOMP] = 0; + enemyMove[ATOM] = 1; + + enemyHeight[GOOMBA] = 40; + enemyHeight[KOOPARED] = 33; + enemyHeight[KOOPAGREEN] = 33; + enemyHeight[KOOPAREDFLYING] = 33; + enemyHeight[BANZAI] = 60; + enemyHeight[WIGGLER] = 33; + enemyHeight[BOO] = 33; + enemyHeight[FIREBOO] = 33; + enemyHeight[BOBOMB] = 33; + enemyHeight[BULLET] = 5; + enemyHeight[WARSHIP] = 50; + enemyHeight[YETI] = 33; + enemyHeight[FLYER] = 50; + enemyHeight[CHOMP] = 60; + enemyHeight[ATOM] = 22; + + + squished[GOOMBA] = area.squishedgoomba; + squished[KOOPARED] = area.redshell; + squished[KOOPAGREEN] = area.greenshell; + squished[KOOPAREDFLYING] = area.koopared; + squished[BANZAI] = area.Banzai; // not actually used + squished[WIGGLER] = area.Wiglerleft; // not actually used + squished[BOO] = area.Boo1; + squished[FIREBOO] = area.Fireboo1; + squished[BOBOMB] = area.Bobomb; + squished[BULLET] = area.Bullet; + squished[WARSHIP] = area.Warship2; + squished[YETI] = area.Yetil1; + squished[FLYER] = area.p1fl; + squished[CHOMP] = area.chainchompdead; + squished[ATOM] = area.Atom1; + + for (int i=0; i < MAXLEVEL; i++) { + floors[i] = area.floor4; + } + floors[0] = area.floor4; + floors[1] = area.floor5; + floors[2] = area.floor3; + floors[3] = area.floor7; + floors[4] = area.floor8; + floors[5] = area.floor9; + floors[6] = area.floor2; + floors[7] = area.floor6; + floors[8] = area.Floor10; + + timer = new Thread(this); + timer.start(); + + } + + public void start() { + // called by Applet Viewer or Browser + doLevel(level); + } + + synchronized void faceRight() { + heroImages[0] = area.herostand; + heroImages[1] = area.hero1; + heroImages[2] = area.herostand; + heroImages[3] = area.hero2; + heroImageNo = 0; + heroleft=false; + } + + synchronized void faceLeft() { + heroImages[0] = area.herostandleft; + heroImages[1] = area.hero1left; + heroImages[2] = area.herostandleft; + heroImages[3] = area.hero2left; + heroImageNo = 0; + heroleft=true; + } + + synchronized void enemyFaceRight(int enemyno) { + enemyImage[enemyno][0] = enemyImages[enemyType[enemyno]][RIGHT][0]; + enemyImage[enemyno][1] = enemyImages[enemyType[enemyno]][RIGHT][1]; + if (enemyType[enemyno] == WIGGLER) + enemyImage[enemyno][2] = enemyImages[enemyType[enemyno]][RIGHT][2]; + enemyDirection[enemyno] = RIGHT; + } + + synchronized void enemyFaceLeft(int enemyno) { + enemyImage[enemyno][0] = enemyImages[enemyType[enemyno]][LEFT][0]; + enemyImage[enemyno][1] = enemyImages[enemyType[enemyno]][LEFT][1]; + if (enemyType[enemyno] == WIGGLER) + enemyImage[enemyno][2] = enemyImages[enemyType[enemyno]][LEFT][2]; + enemyDirection[enemyno] = LEFT; + } + + synchronized void enemyDie(int enemyno) { + //displayStatus(); + enemyImage[enemyno][0] = squished[enemyType[enemyno]]; + enemyImage[enemyno][1] = squished[enemyType[enemyno]]; + if (enemyType[enemyno] == WIGGLER) + enemyImage[enemyno][2] = squished[enemyType[enemyno]]; + } + + synchronized void standStill() { + heroImageNo = 0; + } + + public void doLevel(int level) { + // this runs one 'level' + juststarted = true; + Point temppoint; + dead = false; + + // position Hero at the bottom left + playerPosition = new Point(LEFTEDGE,GROUNDLEVEL); + faceRight(); + + + // *********** THIS STUFF DEPENDS WHAT LEVEL YOU ARE ON ************ + switch (level) { + case 1: + obstacleNumber=4; // 4 pipes for level 1 + enemyNumber = 1; + levellength = 1482; // 2 pages + break; + case 2: + obstacleNumber=11; + enemyNumber = 5; + levellength = 2964; // 4 pages + break; + case 3: + obstacleNumber = 13; + enemyNumber = 8; + levellength = 2223; // 3 pages + break; + case 4: + obstacleNumber =11; + enemyNumber =12; + levellength =4446; // 6 pages + break; + case 5: + obstacleNumber =17; + enemyNumber =13; + levellength =5928; // 8 pages + break; + case 6: + obstacleNumber =14; + enemyNumber =1; + levellength =5928; // 8 pages + break; + case 7: + obstacleNumber =14; + enemyNumber =6; + levellength =3705; // 5 pages + break; + case 8: + obstacleNumber =16; + enemyNumber =9; + levellength =5928; // 8 pages + break; + case 9: + obstacleNumber =6; + enemyNumber =9; + levellength =3705; // 5 pages + break; + case 10: + obstacleNumber =29; + enemyNumber =0; + levellength =4446; // 6 pages + default: + System.out.println("Level " + level + " has not yet been implemented"); + } + enemyImage = new Image[enemyNumber][ENEMYIMAGES];// what is the current image for enemy n? + // initialise piranha states + obstacleImageNo = new int[obstacleNumber]; + hasPiranha = new boolean[obstacleNumber]; + piranhaPopping = new boolean[obstacleNumber]; + isTall = new boolean[obstacleNumber]; + + // initialise the arrays of enemies, etc + enemyPositions = new Point[enemyNumber]; + enemyType = new int[enemyNumber]; + enemyDead = new boolean[enemyNumber]; + obstaclePositions = new Point[obstacleNumber]; + enemyDirection = new int[enemyNumber]; + enemyImageNo = new int[enemyNumber]; + + for (int i=0; i < enemyNumber; i++) { + enemyImageNo[i] = 0; + } + + switch (level) { + // --------------------------------- + // LEVEL 1 + // --------------------------------- + case 1: + for (int i=0; i < obstacleNumber; i++) { + isTall[i] = false; + if (i == 0) { + piranhaPopping[i] = true; + hasPiranha[i] = true; + } + else { + if (i == 3) isTall[i] = true; + piranhaPopping[i] = false; + hasPiranha[i] = false; + } + } + obstaclePositions[0] = new Point(400, GROUNDLEVEL); + obstaclePositions[1] = new Point(950, GROUNDLEVEL); + obstaclePositions[2] = new Point(1245, GROUNDLEVEL); //1255 for adjacent + obstaclePositions[3] = new Point(1320, GROUNDLEVEL); + + enemyPositions[0] = new Point(1000, GOOMBAHEIGHT); + enemyType = new int[] {GOOMBA}; + break; + // ----------------------------------------------- + // LEVEL 2 + // ----------------------------------------------- + case 2: + for (int i=0; i < obstacleNumber; i++) { + isTall[i] = false; + if (i == 2 || i == 7 || i == 8) { + piranhaPopping[i] = true; + hasPiranha[i] = true; + } + else { + if (i== 4 || i == 6 || i == 10) isTall[i] = true; + piranhaPopping[i] = false; + hasPiranha[i] = false; + } + } + + // PAGE 1 + obstaclePositions[0] = new Point(150, GROUNDLEVEL); + obstaclePositions[1] = new Point(225, GROUNDLEVEL); + obstaclePositions[2] = new Point(300, GROUNDLEVEL); + // PAGE 2 + obstaclePositions[3] = new Point(891, GROUNDLEVEL); + obstaclePositions[4] = new Point(966, GROUNDLEVEL); + // PAGE 3 + obstaclePositions[5] = new Point(1632, GROUNDLEVEL); + obstaclePositions[6] = new Point(1707, GROUNDLEVEL); + obstaclePositions[7] = new Point(1782, GROUNDLEVEL); + // PAGE 4 + obstaclePositions[8] = new Point(2373, GROUNDLEVEL); + obstaclePositions[9] = new Point(2743, GROUNDLEVEL); + obstaclePositions[10] = new Point(2818, GROUNDLEVEL); + + enemyType = new int[] {KOOPAGREEN, GOOMBA, GOOMBA, GOOMBA, GOOMBA}; + enemyPositions[0] = new Point(375, KOOPAGREENHEIGHT); + enemyPositions[1] = new Point(1041, GOOMBAHEIGHT); + enemyPositions[2] = new Point(1141, GOOMBAHEIGHT); + enemyPositions[3] = new Point(1882, GOOMBAHEIGHT); + enemyPositions[4] = new Point(2473, GOOMBAHEIGHT); + break; + // ----------------------------------------------- + // LEVEL 3 + // ----------------------------------------------- + case 3: + for (int i=0; i < obstacleNumber; i++) { + isTall[i] = false; + if (i == 4) isTall[i] = true; + if (i != 4 && i != 11 && i != 12) { + piranhaPopping[i] = true; + hasPiranha[i] = true; + } + else { + piranhaPopping[i] = false; + hasPiranha[i] = false; + } + } + // PAGE 1 + obstaclePositions[0] = new Point(50, GROUNDLEVEL); + obstaclePositions[1] = new Point(130, GROUNDLEVEL); + obstaclePositions[2] = new Point(210, GROUNDLEVEL); + + obstaclePositions[3] = new Point(540, GROUNDLEVEL); + obstaclePositions[4] = new Point(620, GROUNDLEVEL); + obstaclePositions[5] = new Point(700, GROUNDLEVEL); + // PAGE 2 + obstaclePositions[6] = new Point(850, GROUNDLEVEL); + obstaclePositions[7] = new Point(925, GROUNDLEVEL); + obstaclePositions[8] = new Point(1000, GROUNDLEVEL); + obstaclePositions[9] = new Point(1075, GROUNDLEVEL); + obstaclePositions[10] = new Point(1150, GROUNDLEVEL); + obstaclePositions[11] = new Point(1350, GROUNDLEVEL); + + // PAGE 3 + obstaclePositions[12] = new Point(2000, GROUNDLEVEL); + + enemyType = new int[] {KOOPAGREEN, GOOMBA, GOOMBA, GOOMBA, GOOMBA, + GOOMBA, GOOMBA, GOOMBA}; + + enemyPositions[0] = new Point(365, KOOPAGREENHEIGHT); + enemyPositions[1] = new Point(420, GOOMBAHEIGHT); + enemyPositions[2] = new Point(495, GOOMBAHEIGHT); + enemyPositions[3] = new Point(1250, GOOMBAHEIGHT); + enemyPositions[4] = new Point(1500, GOOMBAHEIGHT); + enemyPositions[5] = new Point(1575, GOOMBAHEIGHT); + enemyPositions[6] = new Point(1650, GOOMBAHEIGHT); + enemyPositions[7] = new Point(1725, GOOMBAHEIGHT); + + break; + // ----------------------------------------------- + // LEVEL 4 + // ----------------------------------------------- + case 4: + for (int i=0; i < obstacleNumber; i++) { + isTall[i] = false; + if (i == 2 || i == 5 || i == 7 || i == 8 || i == 9 || i == 10) { + piranhaPopping[i] = true; + hasPiranha[i] = true; + } + else { + if (i== 1 || i == 4 || i == 6) isTall[i] = true; + piranhaPopping[i] = false; + hasPiranha[i] = false; + } + } + + // PAGE 1 + obstaclePositions[0] = new Point(185, GROUNDLEVEL); + obstaclePositions[1] = new Point(370, GROUNDLEVEL); + obstaclePositions[2] = new Point(700, GROUNDLEVEL); + // PAGE 2 + obstaclePositions[3] = new Point(900, GROUNDLEVEL); + obstaclePositions[4] = new Point(1300, GROUNDLEVEL); + // PAGE 3 + obstaclePositions[5] = new Point(1500, GROUNDLEVEL); + obstaclePositions[6] = new Point(1750, GROUNDLEVEL); + obstaclePositions[7] = new Point(2000, GROUNDLEVEL); + // PAGE 4 + + // PAGE 5 + obstaclePositions[8] = new Point(3064, GROUNDLEVEL); + obstaclePositions[9] = new Point(3264, GROUNDLEVEL); + // PAGE 6 + obstaclePositions[10] = new Point(4100, GROUNDLEVEL); + + enemyType = new int[] {KOOPARED, KOOPARED, KOOPAREDFLYING, GOOMBA, GOOMBA, + GOOMBA, GOOMBA, KOOPAREDFLYING, KOOPARED, KOOPARED, KOOPARED, FLYER}; + + enemyPositions[0] = new Point(470, KOOPAREDHEIGHT); + enemyPositions[1] = new Point(520, KOOPAREDHEIGHT); + + enemyPositions[2] = new Point(1000, KOOPAREDFLYINGHEIGHT); + enemyPositions[3] = new Point(1400, GOOMBAHEIGHT); + + enemyPositions[4] = new Point(2230, GOOMBAHEIGHT); + enemyPositions[5] = new Point(2280, GOOMBAHEIGHT); + enemyPositions[6] = new Point(2320, GOOMBAHEIGHT); + + enemyPositions[7] = new Point(3600, KOOPAREDFLYINGHEIGHT); + + enemyPositions[8] = new Point(3710, KOOPAREDHEIGHT); + enemyPositions[9] = new Point(3760, KOOPAREDHEIGHT); + enemyPositions[10] = new Point(3810, KOOPAREDHEIGHT); + enemyPositions[11] = new Point(3500, FLYERHEIGHT); + + break; + // ----------------------------------------------- + // LEVEL 5 + // ----------------------------------------------- + case 5: + for ( int i=0; i < obstacleNumber;i++){ + isTall[i] = false; + if (i == 0 || i == 2 || i == 4 || i == 10 || i == 11 || i == 14 || i == 16) { + piranhaPopping[i] = true; + hasPiranha[i] = true; + } + else { + if (i== 1 || i == 3 || i == 6 || i == 7 || i == 8 || i == 9 || i == 12 || i == 15) isTall[i] = true; + piranhaPopping[i] = false; + hasPiranha[i] = false; + } + } + //page1 + obstaclePositions[0] = new Point(150, GROUNDLEVEL); + obstaclePositions[1] = new Point(300, GROUNDLEVEL); + obstaclePositions[2] = new Point(600, GROUNDLEVEL); + //page2 + obstaclePositions[3] = new Point(800, GROUNDLEVEL); + obstaclePositions[4] = new Point(900, GROUNDLEVEL); + //page3 + obstaclePositions[5] = new Point(1600, GROUNDLEVEL); + obstaclePositions[6] = new Point(1700, GROUNDLEVEL); + obstaclePositions[7] = new Point(1800, GROUNDLEVEL); + obstaclePositions[8] = new Point(1900, GROUNDLEVEL); + obstaclePositions[9] = new Point(2000, GROUNDLEVEL); + //page4 + obstaclePositions[10] = new Point(2400, GROUNDLEVEL); + //page5 + obstaclePositions[11] = new Point(3100, GROUNDLEVEL); + obstaclePositions[12] = new Point(3200, GROUNDLEVEL); + //page6 + obstaclePositions[13] = new Point(3850, GROUNDLEVEL); + obstaclePositions[14] = new Point(3950, GROUNDLEVEL); + obstaclePositions[15] = new Point(4050, GROUNDLEVEL); + //page7 + //NONE\\ + //page8 + obstaclePositions[16] = new Point(5550, GROUNDLEVEL); + + enemyType = new int[] {KOOPAREDFLYING, GOOMBA, GOOMBA, KOOPAGREEN, + KOOPAREDFLYING, KOOPAGREEN, KOOPAGREEN, KOOPAGREEN, + KOOPAREDFLYING, KOOPAREDFLYING, GOOMBA, GOOMBA, + GOOMBA}; + + enemyPositions[0] = new Point(450, KOOPAREDFLYINGHEIGHT); + enemyPositions[1] = new Point(700, GOOMBAHEIGHT); + enemyPositions[2] = new Point(1000, GOOMBAHEIGHT); + enemyPositions[3] = new Point(1100, KOOPAGREENHEIGHT); + enemyPositions[4] = new Point(2100, KOOPAREDFLYINGHEIGHT); + enemyPositions[5] = new Point(2500, KOOPAGREENHEIGHT); + enemyPositions[6] = new Point(2600, KOOPAGREENHEIGHT); + enemyPositions[7] = new Point(2700, KOOPAGREENHEIGHT); + enemyPositions[8] = new Point(3400, KOOPAREDFLYINGHEIGHT); + enemyPositions[9] = new Point(3600, KOOPAREDFLYINGHEIGHT); + enemyPositions[10] = new Point(4700, GOOMBAHEIGHT); + enemyPositions[11] = new Point(4800, GOOMBAHEIGHT); + enemyPositions[12] = new Point(4800, GOOMBAHEIGHT); + break; + // ----------------------------------------------- + // LEVEL 6 + // ----------------------------------------------- + case 6: + for ( int i=0; i < obstacleNumber;i++){ + isTall[i] = false; + piranhaPopping[i] = false; + hasPiranha[i] = false; + if (i == 2 || i == 3 || i == 4 || i == 5 || i == 7 || i == 10 || i == 11) { + isTall[i]=true; + } + else { + if (i == 13){ + piranhaPopping[i] = true; + hasPiranha[i] = true; + } + + } + } + obstaclePositions[0] = new Point(350, GROUNDLEVEL); + obstaclePositions[1] = new Point(1091, GROUNDLEVEL); + obstaclePositions[2] = new Point(1191, GROUNDLEVEL); + obstaclePositions[3] = new Point(1600, GROUNDLEVEL); + obstaclePositions[4] = new Point(1675, GROUNDLEVEL); + obstaclePositions[5] = new Point(1750, GROUNDLEVEL); + obstaclePositions[6] = new Point(2500, GROUNDLEVEL); + obstaclePositions[7] = new Point(2600, GROUNDLEVEL); + obstaclePositions[8] = new Point(2700, GROUNDLEVEL); + obstaclePositions[9] = new Point(3975, GROUNDLEVEL); + obstaclePositions[10] = new Point(4050, GROUNDLEVEL); + obstaclePositions[11] = new Point(4150, GROUNDLEVEL); + obstaclePositions[12] = new Point(4225, GROUNDLEVEL); + obstaclePositions[13] = new Point(5550, GROUNDLEVEL); + + enemyPositions[0] = new Point(-400, BANZAIHEIGHT); + enemyType[0] = BANZAI; + + break; + + // ----------------------------------------------- + // LEVEL 7 + // ----------------------------------------------- + case 7: + + for ( int i=0; i < obstacleNumber;i++){ + isTall[i] = false; + piranhaPopping[i] = false; + hasPiranha[i] = false; + if (i == 1 || i == 2 || i == 8) { + isTall[i]=true; + } + else { + if (i == 0 || i == 3 || i == 5 || i == 7 || i == 9 || i == 10 || i == 11){ + piranhaPopping[i] = true; + hasPiranha[i] = true; + } + } + } + obstaclePositions[0] = new Point(250, GROUNDLEVEL); + obstaclePositions[1] = new Point(350, GROUNDLEVEL); + obstaclePositions[2] = new Point(450, GROUNDLEVEL); + obstaclePositions[3] = new Point(550, GROUNDLEVEL); + obstaclePositions[4] = new Point(800, GROUNDLEVEL); + obstaclePositions[5] = new Point(1000, GROUNDLEVEL); + obstaclePositions[6] = new Point(1200, GROUNDLEVEL); + obstaclePositions[7] = new Point(1400, GROUNDLEVEL); + obstaclePositions[8] = new Point(1800, GROUNDLEVEL); + obstaclePositions[9] = new Point(2400, GROUNDLEVEL); + obstaclePositions[10] = new Point(2550, GROUNDLEVEL); + obstaclePositions[11] = new Point(2700, GROUNDLEVEL); + obstaclePositions[12] = new Point(3100, GROUNDLEVEL); + obstaclePositions[13] = new Point(3600, GROUNDLEVEL); + + enemyType = new int[] {GOOMBA, GOOMBA, GOOMBA, GOOMBA, GOOMBA, WIGGLER}; + enemyPositions[0] = new Point(900, GOOMBAHEIGHT); + enemyPositions[1] = new Point(1100, GOOMBAHEIGHT); + enemyPositions[2] = new Point(1300, GOOMBAHEIGHT); + enemyPositions[3] = new Point(1600, GOOMBAHEIGHT); + enemyPositions[4] = new Point(2000, GOOMBAHEIGHT); + enemyPositions[5] = new Point(3250, WIGGLERHEIGHT); + break; + // ----------------------------------------------- + // LEVEL 8 + // ----------------------------------------------- + case 8: + + for ( int i=0; i < obstacleNumber;i++){ + isTall[i] = false; + piranhaPopping[i] = false; + hasPiranha[i] = false; + if (i == 2 || i == 3 || i == 4 || i == 6 || i == 8 || i == 11) { + isTall[i]=true; + } + else { + if (i == 0 || i == 1 || i == 10 || i == 12 || i == 13){ + piranhaPopping[i] = true; + hasPiranha[i] = true; + } + } + } + + obstaclePositions[0] = new Point(100, GROUNDLEVEL); + obstaclePositions[1] = new Point(650, GROUNDLEVEL); + obstaclePositions[2] = new Point(1000, GROUNDLEVEL); + obstaclePositions[3] = new Point(1075, GROUNDLEVEL); + obstaclePositions[4] = new Point(1150, GROUNDLEVEL); + obstaclePositions[5] = new Point(1500, GROUNDLEVEL); + obstaclePositions[6] = new Point(1575, GROUNDLEVEL); + obstaclePositions[7] = new Point(1650, GROUNDLEVEL); + obstaclePositions[8] = new Point(1725, GROUNDLEVEL); + obstaclePositions[9] = new Point(1800, GROUNDLEVEL); + obstaclePositions[10] = new Point(2500, GROUNDLEVEL); + obstaclePositions[11] = new Point(3400, GROUNDLEVEL); + obstaclePositions[12] = new Point(4000, GROUNDLEVEL); + obstaclePositions[13] = new Point(4075, GROUNDLEVEL); + obstaclePositions[14] = new Point(5275, GROUNDLEVEL); + obstaclePositions[15] = new Point(5775, GROUNDLEVEL); + + enemyType = new int [] {BOO, FIREBOO, GOOMBA, BOO, + GOOMBA, FIREBOO, GOOMBA, GOOMBA, BOBOMB}; + + enemyPositions[0] = new Point(350, BOOHEIGHT); + enemyPositions[1] = new Point(900, FIREBOOHEIGHT); + enemyPositions[2] = new Point(1200, GOOMBAHEIGHT); + enemyPositions[3] = new Point(1900, BOOHEIGHT); + enemyPositions[4] = new Point(2600, GOOMBAHEIGHT); + enemyPositions[5] = new Point(3500, FIREBOOHEIGHT); + enemyPositions[6] = new Point(4175, GOOMBAHEIGHT); + enemyPositions[7] = new Point(4250, GOOMBAHEIGHT); + enemyPositions[8] = new Point(5375, BOBOMBHEIGHT); + break; + case 9: + enemyType = new int [] { FLYER, GOOMBA, GOOMBA, KOOPAREDFLYING, KOOPAREDFLYING, KOOPAREDFLYING, KOOPAREDFLYING, KOOPAREDFLYING, CHOMP}; + + enemyPositions[0] = new Point(400, FLYERHEIGHT); + enemyPositions[1] = new Point(950, GOOMBAHEIGHT); + enemyPositions[2] = new Point(1000, GOOMBAHEIGHT); + enemyPositions[3] = new Point(1300, KOOPAREDFLYINGHEIGHT-10); + enemyPositions[4] = new Point(1500, KOOPAREDFLYINGHEIGHT-10); + enemyPositions[5] = new Point(1700, KOOPAREDFLYINGHEIGHT-10); + enemyPositions[6] = new Point(1900, KOOPAREDFLYINGHEIGHT-10); + enemyPositions[7] = new Point(2100, KOOPAREDFLYINGHEIGHT-10); + enemyPositions[8] = new Point(2850, CHOMPHEIGHT); + + for ( int i=0; i < obstacleNumber;i++){ + + piranhaPopping[i] = false; + hasPiranha[i] = false; + if (i == 0 || i == 3 || i == 5) { + isTall[i]=true; + } + else { + if (i == 1 || i == 2 || i == 4){ + piranhaPopping[i] = true; + hasPiranha[i] = true; + } + } + } + + + obstaclePositions[0] = new Point(200, GROUNDLEVEL); + obstaclePositions[1] = new Point(900, GROUNDLEVEL); + obstaclePositions[2] = new Point(1100, GROUNDLEVEL); + obstaclePositions[3] = new Point(2400, GROUNDLEVEL); + obstaclePositions[4] = new Point(2550, GROUNDLEVEL); + obstaclePositions[5] = new Point(2700, GROUNDLEVEL); + + + + + + + + default: + + } + + for (int j=0; j < enemyNumber; j++) { + enemyFaceRight(j); + enemyDead[j] = false; + } + + for (int i=0; i < obstacleNumber; i++) { + if (hasPiranha[i]) { // pick a random image number between 0 and 18 (inclusive) + obstacleImageNo[i] = (int) (Math.random() * 18) / 1; + } + else obstacleImageNo[i] = 0; + } + + // position the warp zone at the end of the level + warpzone = new Point(levellength, GROUNDLEVEL); + // *********** END OF STUFF THAT DEPENDS WHAT LEVEL YOU ARE ON ************ + + ingame = true; + showStatus("Started level " + level); + } + + boolean isPlayerPosition(Point p) { + return(p.x == playerPosition.x && p.y == playerPosition.y); + } + + int isEnemyPosition(Point p) { + for (int i = 0 ; i < enemyNumber; i++) { + if(isEnemyX(p) != -1 && isEnemyY(p) != -1 && !enemyDead[i]) return(i); + } + return(-1); + } + + boolean isObstaclePosition(Point p, boolean forMario) { + int obby; + for (int i = 0 ; i < obstacleNumber; i++) { + obby = isObstacleX(p, forMario); + if(obby != -1 && isObstacleY(p, obby, forMario) != -1) { + return(true); + } + } + return(false); + } + + boolean checkIfBlockingObstacle(Point p) { + boolean result = false; + int obby, obby2; + obby = isObstacleX(p, true); + if(obby != -1 && isBlockingObstacleY(p, obby)) { + piranhaPopping[obby] = false; + result = true; + } + for (int i = 0 ; i < obstacleNumber; i++) { + if (i != obby || !result) { + if (hasPiranha[i]) piranhaPopping[i] = true; + } + } + if (!result) startPosY = GROUNDLEVEL; + return(result); + } + + int isObstacleX(Point p, boolean forMario) { + int obstaclex; + for (int i = 0 ; i < obstacleNumber; i++) { + // if x is >= obstacleposition - (MARIOLEFTOFOBSTACLE) and x <= obstacleposition + (MARIORIGHTOFOBSTACLE) + obstaclex = obstaclePositions[i].x; + if (forMario) { + if(p.x >= (obstaclex - MARIOLEFTOFOBSTACLE) && p.x <= (obstaclex + MARIORIGHTOFOBSTACLE)) + return(i); // return the number of the matching obstacle + } + else { + if(p.x >= (obstaclex - ENEMYLEFTOFOBSTACLE) && p.x <= (obstaclex + ENEMYRIGHTOFOBSTACLE)) + return(i); // return the number of the matching obstacle + } + } + return(-1); + } + + boolean isBlockingObstacleY(Point p, int obstaclenumber) { + String s = "Is Mario blocking pipe " + obstaclenumber + " which is " + (isTall[obstaclenumber] ? "" : "not ") + "tall"; + if (isTall[obstaclenumber]) { + if(p.y <= obstaclePositions[obstaclenumber].y-(OBSTACLEHEIGHT+TALLOBSTACLEDIFF)) { + //System.out.println(s+": Yes"); + return(true); + } + } + else { + if(p.y <= obstaclePositions[obstaclenumber].y-OBSTACLEHEIGHT) { + //System.out.println(s+": Yes"); + return(true); + } + } + //System.out.println(s+": No"); + return(false); + } + + int isObstacleY(Point p, int obstaclenumber, boolean forMario) { + if (isTall[obstaclenumber]) { + if(p.y > obstaclePositions[obstaclenumber].y-(OBSTACLEHEIGHT+TALLOBSTACLEDIFF)) { + return(obstaclenumber); + } + } + else { + if(p.y > obstaclePositions[obstaclenumber].y-OBSTACLEHEIGHT) { + return(obstaclenumber); + } + } + return(-1); + } + + int isEnemyX(Point p) { + int enemyx; + for (int i = 0 ; i < enemyNumber; i++) { + // if x is >= enemyposition - (LEFTOFENEMY) and x <= enemyposition + (RIGHTOFENEMY) + enemyx = enemyPositions[i].x; + //System.out.println("Player got by enemy if " + + // p.x + " >= " + (enemyx - MARIOLEFTOFENEMY) + " && " + p.x + " <= " + (enemyx + MARIORIGHTOFENEMY)); + if(p.x >= (enemyx - MARIOLEFTOFENEMY) && p.x <= (enemyx + MARIORIGHTOFENEMY) && !enemyDead[i]) + return(i); // return the number of the matching enemy + } + return(-1); + } + + int isEnemyY(Point p) { + int offset = herocrouching ? MARIOCROUCHOFFSET : MARIOOFFSET; + for (int i = 0 ; i < enemyNumber; i++) { + if(!enemyDead[i] && + ((p.y+offset <= enemyPositions[i].y+enemySize[enemyType[i]]) && + (p.y+MARIOHEIGHT) >= enemyPositions[i].y)) + return(i); + } + return(-1); + } + + public void finished() { + finished = true; + System.exit(0); + } + + public String getAppletInfo() { + return ("Mario Game"); + } + + int randomMove() { + // return + or - value (randomly) + if (Math.random() >= 0.5) return(24); + else return(-24); + } + + private synchronized void incKeysDown(int whichone) { + keysdown[whichone] = 1; + } + + private synchronized void decKeysDown(int whichone) { + keysdown[whichone] = 0; + } + + // this class will use just the key pressed event + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_F1) { + displayStatus(); + } + if (ingame) { + if (! + (e.getKeyCode() == KeyEvent.VK_LEFT && playerPosition.x <= (LEFTEDGE + XAMOUNT))) { + + // valid move: move the player and then move the enemies + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + herocrouching = true; + incKeysDown(DOWNDOWN); + setSomethingChangedSinceRepaint(true); + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + incKeysDown(LEFTDOWN); + leftPressed(false); + setSomethingChangedSinceRepaint(true); + } + else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + incKeysDown(RIGHTDOWN); + rightPressed(false); + setSomethingChangedSinceRepaint(true); + } + else if (e.getKeyCode() == KeyEvent.VK_SPACE) { + if (!jumping) { + startPosY = playerPosition.y; + jumping = true; + onTheWayUp=true; + setSomethingChangedSinceRepaint(true); + } + } + if (somethingChangedSinceRepaint) { + area.repaint(); + } + } // if valid key press + } + else if (e.getKeyCode() == KeyEvent.VK_ENTER) { + if (level == MAXLEVEL || dead) doLevel(level); + else doLevel(++level); + page=0; + area.repaint(); + } + } + + /*synchronized*/ void setSomethingChangedSinceRepaint(boolean val) { + somethingChangedSinceRepaint = val; + } + + void leftPressed(boolean skid) { + if (!herocrouching) { + // if Hero was facing right, turn him left + if (!heroleft) + faceLeft(); + else { + // if the target position is not occupied by a obstacle... + for (int i=0; i < obstacleNumber; i++) { + if (isObstaclePosition(new Point(playerPosition.x-XAMOUNT, playerPosition.y), true)) + return; // can't move + } + playerPosition.x -= XAMOUNT; + if (!skid) incrementHeroImage(); + } + } + } + + void rightPressed(boolean skid) { + if (!herocrouching) { + if ((playerPosition.x + SPACE_FROM_X_TO_MARIO) >= (warpzone.x+4)) { + // level complete! + ingame=false; + } + else { + // if Hero was facing left, turn him right + if (heroleft) + faceRight(); + else { + for (int i=0; i < obstacleNumber; i++) { + if (isObstaclePosition(new Point(playerPosition.x+XAMOUNT, playerPosition.y), true)) + return; // can't move + } + playerPosition.x += XAMOUNT; + //System.out.println("Mario's x position is " + playerPosition.x); + if (!skid) incrementHeroImage(); + } + } + } + } + + boolean anythingVisibleChanged() { + return(somethingChangedSinceRepaint); + } + + public void run() { + boolean odd=true; // only change piranha image every other cycle + while (true) { + if (juststarted) { + try {Thread.sleep(750);} + catch (Exception e) {} + area.repaint(); + juststarted = false; + } + try {Thread.sleep(DELAY);} + catch (InterruptedException e){} + if (ingame) { + if (keysdown[LEFTDOWN] == 0 && + keysdown[RIGHTDOWN] == 0 && + keysdown[DOWNDOWN] == 0) standStill(); + + if (keysdown[LEFTDOWN] > 0) { + leftPressed(false); + setSomethingChangedSinceRepaint(true); + } + else if (keysdown[RIGHTDOWN] > 0) { + rightPressed(false); + setSomethingChangedSinceRepaint(true); + } + + if (!odd) { + // for each obstacle, cycle through the piranha pictures + for (int i=0; i < obstacleNumber; i++) { + if (piranhaPopping[i]) { + incrementObstacleImage(i); + if (isVisibleObstacle(i)) setSomethingChangedSinceRepaint(true); + } + } + } + odd = !odd; + + // for each enemy, move the enemy in the direction it was going + for (int i=0; i < enemyNumber; i++) { + // TODO if there is a fatal obstacle at that position, fall into it and decrement count of enemies + // and set that enemy's position to -1, -1 + /* + if (isObstaclePosition(enemyPositions[i])) { + showStatus("A enemy fell into a obstacle"); + + enemyPositions[i] = new Point(-1, -1); + enemiesRemaining--; + showStatus(enemyNumber-enemiesRemaining + " down, " + enemiesRemaining + " to go..."); + } + */ + // if there is a non-fatal obstacle + if (isObstaclePosition(enemyPositions[i],false) && enemyType[i] != BANZAI) { + // change direction + changeDirection(i); + if (isVisibleEnemy(i)) setSomethingChangedSinceRepaint(true); + } + if (!enemyDead[i]) { + enemyPositions[i] = move(i, enemyPositions[i], enemyDirection[i], odd); + if (isVisibleEnemy(i)) setSomethingChangedSinceRepaint(true); + } + + // if player is caught by a enemy, end the game + int enemyno = isEnemyPosition(playerPosition); + if (enemyno > -1) { + int NEEDTOBEABOVE = enemyPositions[enemyno].y+enemyTopSpace[enemyno]-MARIOHEIGHT; + if (easymode) NEEDTOBEABOVE = enemyPositions[enemyno].y-enemyHeight[enemyType[enemyno]]; + if ((!onTheWayUp && (playerPosition.y <=NEEDTOBEABOVE)) && enemyType[enemyno] != BANZAI) { + // player may have squished an enemy + if (enemyType[enemyno] == KOOPAREDFLYING) { + enemyType[enemyno] = KOOPARED; + enemyPositions[enemyno].y = KOOPAREDHEIGHT; + if (enemyDirection[enemyno] == LEFT) enemyFaceLeft(enemyno); + else enemyFaceRight(enemyno); + } + else { + enemyDead[enemyno]=true; + enemyDie(enemyno); + } + // player bounces + bouncing = true; + startPosY = playerPosition.y; + setSomethingChangedSinceRepaint(true); + } + else { + int offset = herocrouching ? MARIOCROUCHOFFSET : MARIOOFFSET; + if (playerPosition.y > NEEDTOBEABOVE && + (playerPosition.y+offset <= enemyPositions[enemyno].y+enemySize[enemyType[enemyno]])) { + die(); + setSomethingChangedSinceRepaint(true); + } + } + } + } + if (!dead) { + if (onTheWayUp) { + if (playerPosition.y > startPosY-JUMPAMOUNT) { + playerPosition = new Point(playerPosition.x, playerPosition.y - RISEAMOUNT); + setSomethingChangedSinceRepaint(true); + } + else { + onTheWayUp=false; + } + } + else if (bouncing) { + if (playerPosition.y > startPosY-BOUNCEAMOUNT) { + playerPosition = new Point(playerPosition.x, playerPosition.y - RISEAMOUNT); + setSomethingChangedSinceRepaint(true); + } + else { + bouncing=false; + wasbouncing = true; + } + } + else { + int obstacleno = isObstacleX(playerPosition, true); + if (obstacleno == -1) { // no obstacle at this position + if (!onTheWayUp && !bouncing) { + if (playerPosition.y < startPosY) { + playerPosition = new Point(playerPosition.x, playerPosition.y+FALLAMOUNT); + if (playerPosition.y >= GROUNDLEVEL && floorIsIcy()) { + if (!wasbouncing) { + if (heroleft) skidLeft(); + else skidRight(); + } + } + wasbouncing = false; + setSomethingChangedSinceRepaint(true); + } + else jumping = false; + } + } + else { + Point obstaclepos = obstaclePositions[obstacleno]; + // if hero's y position <= obstacle's height + int thisObstacleHeight = isTall[obstacleno] ? OBSTACLEHEIGHT+TALLOBSTACLEDIFF : OBSTACLEHEIGHT; + if (playerPosition.y <= (obstaclepos.y-thisObstacleHeight) && // can't land on the obstacle if just < (??!) + (playerPosition.y+FALLAMOUNT >= (obstaclepos.y-thisObstacleHeight)) + ) { + // allow hero to land on the obstacle + jumping=false; + if (playerPosition.y != obstaclepos.y-thisObstacleHeight) setSomethingChangedSinceRepaint(true); + playerPosition = new Point(playerPosition.x, obstaclepos.y-thisObstacleHeight); + // if the piranha was up, Hero dies + if (obstacleImages[obstacleImageNo[obstacleno]] != area.obstacle) { + die(); + } + else { + // otherwise stop this Piranha + piranhaPopping[obstacleno] = false; + } + } + else { + if (!onTheWayUp && !bouncing) { + if (playerPosition.y < startPosY) { + setSomethingChangedSinceRepaint(true); + playerPosition = new Point(playerPosition.x, playerPosition.y+FALLAMOUNT); + if (playerPosition.y >= GROUNDLEVEL && floorIsIcy()) { + if (!wasbouncing) { + if (heroleft) skidLeft(); + else skidRight(); + } + } + wasbouncing = false; + } + else jumping = false; + } + } + } + } + if (!dead) { + checkIfBlockingObstacle(playerPosition); + if (playerPosition.y > GROUNDLEVEL) playerPosition.y = GROUNDLEVEL; + } + if (anythingVisibleChanged()) { + area.repaint(); + } + } + else { + if (!area.showingMessage) + area.repaint(); + } + } + } + } + + boolean isVisibleObstacle(int i) { + // TODO - this probably needs fixing when obstacle is near page boundary + return ((obstaclePositions[i].x >= page*PAGEWIDTH) && + (obstaclePositions[i].x < (page+1)*PAGEWIDTH)); + } + + boolean isVisibleEnemy(int i) { + // TODO - this probably needs fixing when enemy is near page boundary + return ((enemyPositions[i].x >= page*PAGEWIDTH) && + (enemyPositions[i].x < (page+1)*PAGEWIDTH) && !enemyDead[i]); + } + + void changeDirection(int enemyno) { + if (enemyDirection[enemyno] == LEFT) { + enemyFaceRight(enemyno); + } + else { + enemyFaceLeft(enemyno); + } + } + + synchronized void die() { + showStatus("The Player is dead. Press the Enter key to restart the level"); + ingame=false; + dead = true; + displayStatus(); + } + + synchronized void incrementObstacleImage(int i) { + obstacleImageNo[i]++; + if (obstacleImageNo[i] == OBSTACLEIMAGES) obstacleImageNo[i] = 0; + } + + synchronized void incrementHeroImage() { + heroImageNo++; + if (heroImageNo == HEROIMAGES) heroImageNo = 0; + } + + synchronized void incrementEnemyImage(int i) { + enemyImageNo[i]++; + if (enemyType[i] == WIGGLER) { + if (enemyImageNo[i] > (ENEMYIMAGES-1) ) enemyImageNo[i] = 0; + } + else { + if (enemyImageNo[i] > (ENEMYIMAGES-2) ) enemyImageNo[i] = 0; + } + } + + Point move(int enemyNo, Point start, int direction, boolean odd) { + if (odd) incrementEnemyImage(enemyNo); + if (direction == LEFT) { + return(new Point(start.x -enemyMove[enemyType[enemyNo]], start.y)); + } + else { + return(new Point(start.x +enemyMove[enemyType[enemyNo]], start.y)); + } + } + + public void keyReleased(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + herocrouching = false; + decKeysDown(DOWNDOWN); + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + if (floorIsIcy()) { + skidLeft(); + } + decKeysDown(LEFTDOWN); + } + else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + if (floorIsIcy()) { + skidRight(); + } + decKeysDown(RIGHTDOWN); + } + } + + public void keyTyped(KeyEvent e) { + } + + synchronized Image getHeroImage() { + return(heroImages[heroImageNo]); + } + + synchronized Image getObstacleImage(int obstaclenum) { + return(obstacleImages[obstacleImageNo[obstaclenum]]); + } + + synchronized Image getEnemyImage(int enemyno) { + return(enemyImage[enemyno][enemyImageNo[enemyno]]); + } + + boolean floorIsIcy() { + return(floors[level-1] == area.icefloor); + } + + void skidLeft() { + for (int i = 0; i < 6; i++) { + leftPressed(true); + try {Thread.sleep(7);} + catch (Exception e) {} + area.repaint(); + } + } + + void skidRight() { + for (int i = 0; i < 6; i++) { + rightPressed(true); + area.repaint(); + try {Thread.sleep(7);} + catch (Exception e) {} + } + } + + void displayStatus() { + /* + // when a certain F Key is pressed, display positions of Mario, + // all pipes and all enemies and the end flag (warp zone) + System.out.println("--------"); + System.out.println("Mario is " + (dead? "dead" : "alive")); + if (dead) { + int enemyno = isEnemyPosition(playerPosition); + System.out.println("Mario was killed by enemy " + enemyno); + } + System.out.println("In game is " + ingame); + System.out.println("Mario is " + (onTheWayUp? "on the way up" : "not on the way up")); + System.out.println("Mario's position is (" + playerPosition.x + ", " + playerPosition.y + ")"); + System.out.println("Mario's visible left, bottom co-ordinates are " + (playerPosition.x + 55) + " and " + (playerPosition.y + MARIOHEIGHT)); + System.out.println("Mario is on page " + page + " (which shows x positions from " + (page*PAGEWIDTH) + " to " + ((page+1)*PAGEWIDTH) + ")"); + System.out.println("Screen bounds are (" + getBounds().width + ", " + getBounds().height + ")"); + System.out.println(""); + for (int enemy=0; enemy < enemyNumber; enemy++) { + System.out.println("Enemy " + enemy + " is " + enemyTypeString(enemyType[enemy]) + " and is " + + (enemyDead[enemy] ? " " : "not ") + "dead"); + System.out.println("Enemy " + enemy + " is at position (" + enemyPositions[enemy].x + + ", " + enemyPositions[enemy].y+") and has size " + enemySize[enemyType[enemy]]); + } + //System.out.println(""); + //for (int obstacle=0; obstacle < obstacleNumber; obstacle++) { + // System.out.println("Obstacle " + obstacle + " is at position (" + obstaclePositions[obstacle].x + + // ", " + obstaclePositions[obstacle].y+")"); + //} + System.out.println(""); + System.out.println("The warp zone is positioned at (" + warpzone.x + ", " + warpzone.y + ")"); + System.out.println("========"); + */ + } + + String enemyTypeString(int fortype) { + switch (fortype) { + case GOOMBA: + return("GOOMBA"); + case KOOPARED: + return("KOOPA RED"); + case KOOPAGREEN: + return("KOOPA GREEN"); + case KOOPAREDFLYING: + return("KOOPA RED FLYING"); + case BANZAI: + return("BANZAI"); + case WIGGLER: + return("WIGGLER"); + case BOO: + return("BOO"); + case FIREBOO: + return("FOREBOO"); + case BOBOMB: + return("BOBOMB"); + case BULLET: + return("BULLET"); + case WARSHIP: + return("WARSHIP"); + case YETI: + return("YETI"); + case FLYER: + return("FLYER"); + default: + return("Unknown type (" + fortype + ")"); + } + } + + void changePageIfNecessary() { + if (playerPosition.x == LEFTEDGE) return; + if ((playerPosition.x+SPACE_FROM_X_TO_MARIO) > (page*PAGEWIDTH+RIGHTEDGE-XAMOUNT)) { + //System.out.println("Change page up: (" + playerPosition.x+ "+" + SPACE_FROM_X_TO_MARIO+ ") > (" + page+ "*" + PAGEWIDTH + "+" + RIGHTEDGE + "-" + XAMOUNT + ")"); + page++; + } + else if ((playerPosition.x+SPACE_FROM_X_TO_MARIO)-(page*PAGEWIDTH) < (LEFTEDGE+XAMOUNT)) { + //System.out.println("Change page down: (" + playerPosition.x+ "+" + SPACE_FROM_X_TO_MARIO+ ")-(" + page+ "*" + PAGEWIDTH + ") < (" + LEFTEDGE+ "+" + XAMOUNT+")"); + page--; + } + } +} + diff --git a/Mario/Mario/Robot.gif b/Mario/Mario/Robot.gif Binary files differ. diff --git a/Mario/Mario/Snowman.gif b/Mario/Mario/Snowman.gif Binary files differ. diff --git a/Mario/Mario/Wigler1.5Left.gif b/Mario/Mario/Wigler1.5Left.gif Binary files differ. diff --git a/Mario/Mario/Wigler1.5Right.gif b/Mario/Mario/Wigler1.5Right.gif Binary files differ. diff --git a/Mario/Mario/Wigler1Left.gif b/Mario/Mario/Wigler1Left.gif Binary files differ. diff --git a/Mario/Mario/Wigler1Right.gif b/Mario/Mario/Wigler1Right.gif Binary files differ. diff --git a/Mario/Mario/Wigler2Left.gif b/Mario/Mario/Wigler2Left.gif Binary files differ. diff --git a/Mario/Mario/Wigler2Right.gif b/Mario/Mario/Wigler2Right.gif Binary files differ. diff --git a/Mario/Mario/bobomb.gif b/Mario/Mario/bobomb.gif Binary files differ. diff --git a/Mario/Mario/bobomb2.gif b/Mario/Mario/bobomb2.gif Binary files differ. diff --git a/Mario/Mario/bobombbang1.gif b/Mario/Mario/bobombbang1.gif Binary files differ. diff --git a/Mario/Mario/bobombbang2.gif b/Mario/Mario/bobombbang2.gif Binary files differ. diff --git a/Mario/Mario/bobombf2.gif b/Mario/Mario/bobombf2.gif Binary files differ. diff --git a/Mario/Mario/bobombr.gif b/Mario/Mario/bobombr.gif Binary files differ. diff --git a/Mario/Mario/boo1.gif b/Mario/Mario/boo1.gif Binary files differ. diff --git a/Mario/Mario/boo2.gif b/Mario/Mario/boo2.gif Binary files differ. diff --git a/Mario/Mario/cannon.gif b/Mario/Mario/cannon.gif Binary files differ. diff --git a/Mario/Mario/cool cube.gif b/Mario/Mario/cool cube.gif Binary files differ. diff --git a/Mario/Mario/cube.gif b/Mario/Mario/cube.gif Binary files differ. diff --git a/Mario/Mario/fireboo1.gif b/Mario/Mario/fireboo1.gif Binary files differ. diff --git a/Mario/Mario/fireboo2.gif b/Mario/Mario/fireboo2.gif Binary files differ. diff --git a/Mario/Mario/goomba.gif b/Mario/Mario/goomba.gif Binary files differ. diff --git a/Mario/Mario/goomba2.gif b/Mario/Mario/goomba2.gif Binary files differ. diff --git a/Mario/Mario/goombaleft.gif b/Mario/Mario/goombaleft.gif Binary files differ. diff --git a/Mario/Mario/goombaleft2.gif b/Mario/Mario/goombaleft2.gif Binary files differ. diff --git a/Mario/Mario/goombasquished.gif b/Mario/Mario/goombasquished.gif Binary files differ. diff --git a/Mario/Mario/java.policy.applet b/Mario/Mario/java.policy.applet @@ -0,0 +1,7 @@ +/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/ +/* DO NOT EDIT */ + +grant { + permission java.security.AllPermission; +}; + diff --git a/Mario/Mario/koopaparatroopa1.gif b/Mario/Mario/koopaparatroopa1.gif Binary files differ. diff --git a/Mario/Mario/koopaparatroopa1left.gif b/Mario/Mario/koopaparatroopa1left.gif Binary files differ. diff --git a/Mario/Mario/koopaparatroopa2.gif b/Mario/Mario/koopaparatroopa2.gif Binary files differ. diff --git a/Mario/Mario/koopaparatroopa2left.gif b/Mario/Mario/koopaparatroopa2left.gif Binary files differ. diff --git a/Mario/Mario/koopaparatroopashell.gif b/Mario/Mario/koopaparatroopashell.gif Binary files differ. diff --git a/Mario/Mario/koopatroopa.gif b/Mario/Mario/koopatroopa.gif Binary files differ. diff --git a/Mario/Mario/koopatroopaleft.gif b/Mario/Mario/koopatroopaleft.gif Binary files differ. diff --git a/Mario/Mario/koopatroopashell.gif b/Mario/Mario/koopatroopashell.gif Binary files differ. diff --git a/Mario/Mario/luigi1.gif b/Mario/Mario/luigi1.gif Binary files differ. diff --git a/Mario/Mario/luigi1left.gif b/Mario/Mario/luigi1left.gif Binary files differ. diff --git a/Mario/Mario/luigi2.gif b/Mario/Mario/luigi2.gif Binary files differ. diff --git a/Mario/Mario/luigi2left.gif b/Mario/Mario/luigi2left.gif Binary files differ. diff --git a/Mario/Mario/luigicrouch.gif b/Mario/Mario/luigicrouch.gif Binary files differ. diff --git a/Mario/Mario/luigicrouchleft.gif b/Mario/Mario/luigicrouchleft.gif Binary files differ. diff --git a/Mario/Mario/luigijump.gif b/Mario/Mario/luigijump.gif Binary files differ. diff --git a/Mario/Mario/luigijumpleft.gif b/Mario/Mario/luigijumpleft.gif Binary files differ. diff --git a/Mario/Mario/luigistand.gif b/Mario/Mario/luigistand.gif Binary files differ. diff --git a/Mario/Mario/luigistandleft.gif b/Mario/Mario/luigistandleft.gif Binary files differ. diff --git a/Mario/Mario/mario.ico b/Mario/Mario/mario.ico Binary files differ. diff --git a/Mario/Mario/mario1.gif b/Mario/Mario/mario1.gif Binary files differ. diff --git a/Mario/Mario/mario1left.gif b/Mario/Mario/mario1left.gif Binary files differ. diff --git a/Mario/Mario/mario2.gif b/Mario/Mario/mario2.gif Binary files differ. diff --git a/Mario/Mario/mario2left.gif b/Mario/Mario/mario2left.gif Binary files differ. diff --git a/Mario/Mario/marioblo.gif b/Mario/Mario/marioblo.gif Binary files differ. diff --git a/Mario/Mario/marioblock.gif b/Mario/Mario/marioblock.gif Binary files differ. diff --git a/Mario/Mario/mariobox.gif b/Mario/Mario/mariobox.gif Binary files differ. diff --git a/Mario/Mario/mariocoin1.gif b/Mario/Mario/mariocoin1.gif Binary files differ. diff --git a/Mario/Mario/mariocoin2.gif b/Mario/Mario/mariocoin2.gif Binary files differ. diff --git a/Mario/Mario/mariocoin3.gif b/Mario/Mario/mariocoin3.gif Binary files differ. diff --git a/Mario/Mario/mariocrouch.gif b/Mario/Mario/mariocrouch.gif Binary files differ. diff --git a/Mario/Mario/mariocrouchleft.gif b/Mario/Mario/mariocrouchleft.gif Binary files differ. diff --git a/Mario/Mario/mariodead.gif b/Mario/Mario/mariodead.gif Binary files differ. diff --git a/Mario/Mario/mariofloor.gif b/Mario/Mario/mariofloor.gif Binary files differ. diff --git a/Mario/Mario/mariofloor10.gif b/Mario/Mario/mariofloor10.gif Binary files differ. diff --git a/Mario/Mario/mariofloor2.gif b/Mario/Mario/mariofloor2.gif Binary files differ. diff --git a/Mario/Mario/mariofloor3.gif b/Mario/Mario/mariofloor3.gif Binary files differ. diff --git a/Mario/Mario/mariofloor4.gif b/Mario/Mario/mariofloor4.gif Binary files differ. diff --git a/Mario/Mario/mariofloor5.gif b/Mario/Mario/mariofloor5.gif Binary files differ. diff --git a/Mario/Mario/mariofloor6.gif b/Mario/Mario/mariofloor6.gif Binary files differ. diff --git a/Mario/Mario/mariofloor7.gif b/Mario/Mario/mariofloor7.gif Binary files differ. diff --git a/Mario/Mario/mariofloor8.gif b/Mario/Mario/mariofloor8.gif Binary files differ. diff --git a/Mario/Mario/mariofloor9.gif b/Mario/Mario/mariofloor9.gif Binary files differ. diff --git a/Mario/Mario/mariograss.gif b/Mario/Mario/mariograss.gif Binary files differ. diff --git a/Mario/Mario/marioicon.gif b/Mario/Mario/marioicon.gif Binary files differ. diff --git a/Mario/Mario/mariojump.gif b/Mario/Mario/mariojump.gif Binary files differ. diff --git a/Mario/Mario/mariojumpleft.gif b/Mario/Mario/mariojumpleft.gif Binary files differ. diff --git a/Mario/Mario/mariometalbox.gif b/Mario/Mario/mariometalbox.gif Binary files differ. diff --git a/Mario/Mario/mariopipe.gif b/Mario/Mario/mariopipe.gif Binary files differ. diff --git a/Mario/Mario/mariopipe2.gif b/Mario/Mario/mariopipe2.gif Binary files differ. diff --git a/Mario/Mario/mariostand.gif b/Mario/Mario/mariostand.gif Binary files differ. diff --git a/Mario/Mario/mariostandleft.gif b/Mario/Mario/mariostandleft.gif Binary files differ. diff --git a/Mario/Mario/mariotitle.gif b/Mario/Mario/mariotitle.gif Binary files differ. diff --git a/Mario/Mario/mariowarp.gif b/Mario/Mario/mariowarp.gif Binary files differ. diff --git a/Mario/Mario/missioncomplete.gif b/Mario/Mario/missioncomplete.gif Binary files differ. diff --git a/Mario/Mario/piranhaflying1.gif b/Mario/Mario/piranhaflying1.gif Binary files differ. diff --git a/Mario/Mario/piranhaflying2.gif b/Mario/Mario/piranhaflying2.gif Binary files differ. diff --git a/Mario/Mario/piranhaplant1.gif b/Mario/Mario/piranhaplant1.gif Binary files differ. diff --git a/Mario/Mario/piranhaplant1huge.gif b/Mario/Mario/piranhaplant1huge.gif Binary files differ. diff --git a/Mario/Mario/piranhaplant2.gif b/Mario/Mario/piranhaplant2.gif Binary files differ. diff --git a/Mario/Mario/piranhaplant2huge.gif b/Mario/Mario/piranhaplant2huge.gif Binary files differ. diff --git a/Mario/Mario/piranhaplantboss.gif b/Mario/Mario/piranhaplantboss.gif Binary files differ. diff --git a/Mario/Mario/piranhaplantboss2.gif b/Mario/Mario/piranhaplantboss2.gif Binary files differ. diff --git a/Mario/Mario/piranhaplantbossA.gif b/Mario/Mario/piranhaplantbossA.gif Binary files differ. diff --git a/Mario/Mario/piranhaplantbossB.gif b/Mario/Mario/piranhaplantbossB.gif Binary files differ. diff --git a/Mario/Mario/piranhaplantbossC.gif b/Mario/Mario/piranhaplantbossC.gif Binary files differ. diff --git a/Mario/Mario/piranhaplantbossD.gif b/Mario/Mario/piranhaplantbossD.gif Binary files differ. diff --git a/Mario/Mario/piranhaplantbossE.gif b/Mario/Mario/piranhaplantbossE.gif Binary files differ. diff --git a/Mario/Mario/piranhaplantbossf.gif b/Mario/Mario/piranhaplantbossf.gif Binary files differ. diff --git a/Mario/Mario/piranhaplanthugepeep.gif b/Mario/Mario/piranhaplanthugepeep.gif Binary files differ. diff --git a/Mario/Mario/piranhaplanthugepeepo.gif b/Mario/Mario/piranhaplanthugepeepo.gif Binary files differ. diff --git a/Mario/Mario/piranhaplanthugepeepy.gif b/Mario/Mario/piranhaplanthugepeepy.gif Binary files differ. diff --git a/Mario/Mario/piranharightflying1.gif b/Mario/Mario/piranharightflying1.gif Binary files differ. diff --git a/Mario/Mario/piranharightflying2.gif b/Mario/Mario/piranharightflying2.gif Binary files differ. diff --git a/Mario/Mario/poisonmushroom.gif b/Mario/Mario/poisonmushroom.gif Binary files differ. diff --git a/Mario/Mario/supaturtle.gif b/Mario/Mario/supaturtle.gif Binary files differ. diff --git a/Mario/Mario/super cannon.gif b/Mario/Mario/super cannon.gif Binary files differ. diff --git a/Mario/Mario/warship1.gif b/Mario/Mario/warship1.gif Binary files differ. diff --git a/Mario/Mario/warship2.gif b/Mario/Mario/warship2.gif Binary files differ. diff --git a/Mario/Mario/yes.bmp b/Mario/Mario/yes.bmp Binary files differ. diff --git a/Mario/Mario/yetileft1.gif b/Mario/Mario/yetileft1.gif Binary files differ. diff --git a/Mario/Mario/yetileft2.gif b/Mario/Mario/yetileft2.gif Binary files differ. diff --git a/Mario/Mario/yetiright1.gif b/Mario/Mario/yetiright1.gif Binary files differ. diff --git a/Mario/Mario/yetiright2.gif b/Mario/Mario/yetiright2.gif Binary files differ. diff --git a/Pong.html b/Pong.html @@ -0,0 +1,8 @@ +<HTML> +<HEAD> +<TITLE>Pong Game</TITLE> +</HEAD> +<BODY> +<APPLET CODE="Pong.PongGame.class" WIDTH=800 HEIGHT=600 X=200 Y=0></APPLET> +</BODY> +</HTML> diff --git a/Pong/Pong/Pong/paddle.gif b/Pong/Pong/Pong/paddle.gif Binary files differ. diff --git a/Pong/Pong/PongArea.java b/Pong/Pong/PongArea.java @@ -0,0 +1,43 @@ +package Pong; + +import java.awt.*; + +public class PongArea extends Panel { + PongGame myApplet = null; + Image paddle; + Color[] colours = new Color[] {Color.white, Color.blue, Color.green, Color.red, Color.yellow}; + int colourno=0; + + public PongArea(PongGame parent) { + myApplet = parent; + paddle = parent.getImage(myApplet.getCodeBase(), "Pong\\" + "paddle.gif"); + } + + public void paint (Graphics g) { + if (myApplet == null) return; + final int w = getBounds().width; + final int h = getBounds().height; + g.setColor(Color.gray); + g.fillRect(0, 0, w, h); + FontMetrics fm = getFontMetrics(getFont()); + + g.setColor(Color.black); + int asc = fm.getAscent() + 4; + + if (myApplet.playerPosition != null) { + // show the player's paddle + //g.drawString("|", myApplet.playerPosition.x, myApplet.playerPosition.y); + g.drawImage(paddle, myApplet.playerPosition.x, myApplet.playerPosition.y,Color.gray, null); + + // show the ball + colourno=0;//<-------remove this for confusion mode! + for (int i=0; i < myApplet.ballPositions.length; i++) { + if (myApplet.ballPositions[i].x > -1) + //g.drawImage(pongImage, myApplet.ballPositions[i].x, myApplet.ballPositions[i].y,null); + g.setColor(colours[colourno++]); + if (colourno >= colours.length) colourno = 0; + g.drawString("O", myApplet.ballPositions[i].x, myApplet.ballPositions[i].y); + } + } + } +}+ \ No newline at end of file diff --git a/Pong/Pong/PongFrame.java b/Pong/Pong/PongFrame.java @@ -0,0 +1,10 @@ +package Pong; + +import java.awt.Frame; + +public class PongFrame extends Frame { + + public PongFrame() { + setBounds(200, 200, 200, 200); + } +}+ \ No newline at end of file diff --git a/Pong/Pong/PongGame.java b/Pong/Pong/PongGame.java @@ -0,0 +1,245 @@ +/* Copyright (c) Mike Percival 2004 */ +/* Pong game Created April 2004 */ + +package Pong; + +import java.awt.*; +import java.awt.event.*; +import java.applet.*; + +public class PongGame extends Applet implements KeyListener, Runnable { + // all member variables 'static' because shared with the ball action thread + private static PongArea area; + private static boolean finished = false; + private static boolean ingame = false; + private boolean juststarted = false; + private static int level = 1; + protected static Point[] ballPositions; + protected static Point playerPosition; + private Thread balls; + + protected static int ballNumber = 1; + protected static int RIGHTEDGE = 1200; + protected static final int LEFTEDGE = 0; + protected static final int TOPEDGE = 0; + protected static int BOTTOMEDGE = 1000; + protected static int BALL_XAMOUNT=3; + protected static int BALL_YAMOUNT=3; + protected static int PLAYER_XAMOUNT=12; + protected static int PLAYER_YAMOUNT=12; + private static final int X = 1; + private static final int Y = 2; + private static final int NOT=3; + private static final int DELAY = 15; + boolean[] goingLeft, goingRight, goingUp, goingDown; + boolean deadball = false; + int timeSinceLastBall=0; + + public void init() { + + setLayout(null); + setBackground(Color.gray); + + area = new PongArea(this); + add(area); + FontMetrics fm = getFontMetrics(getFont()); + RIGHTEDGE = getBounds().width - 1; + BOTTOMEDGE = getBounds().height - 1; + setVisible(true); + area.setBounds(0,0,RIGHTEDGE,BOTTOMEDGE); + area.setVisible(true); + + addKeyListener(this); + area.addKeyListener(this); + area.requestFocus(); + + balls = new Thread(this); + balls.start(); + } + + public void start() { + // called by Applet Viewer or Browser + doLevel(1); + } + + public void doLevel(int level) { + // this runs one 'level' + // create arrays of ball balls here. + // Maybe each level will have different numbers? + juststarted = true; + deadball=false; + ballNumber = 1; + ballPositions = new Point[ballNumber]; + goingLeft = new boolean[ballNumber]; + goingRight = new boolean[ballNumber]; + goingUp = new boolean[ballNumber]; + goingDown = new boolean[ballNumber]; + for (int i=0; i < ballNumber; i++) { + ballPositions[i] = new Point(0,0); + goingLeft[i] = true; + goingRight[i] = false; + goingUp[i] =false; + goingDown[i] =true; + } + + showStatus("Started level " + level); + + // randomly position 1 player, x balls + playerPosition = new Point(RIGHTEDGE-20, 0); + + for (int i = 0; i < ballNumber; i++) { + ballPositions[i] = randomPosition(); + } + + // paint the panel here + area.repaint(); + ingame = true; + } + + private Point randomPosition() { + Point p = new Point( (int) (Math.random() * RIGHTEDGE) / BALL_XAMOUNT * BALL_XAMOUNT, + (int) 0); + if (p.x >= RIGHTEDGE*2/3) p.x = p.x - RIGHTEDGE/3; + return(p); + } + + synchronized void addABall() { + System.out.println("ADD A BALL!"); + Point[] newBallPos = new Point[ballNumber+1]; + boolean[] newgl=new boolean[ballNumber+1], newgr=new boolean[ballNumber+1], newgu=new boolean[ballNumber+1], newgd=new boolean[ballNumber+1]; + for (int i = 0; i < ballNumber; i++) { + newBallPos[i] = new Point(ballPositions[i]); + newgl[i] = goingLeft[i]; + newgr[i] = goingRight[i]; + newgu[i] = goingUp[i]; + newgd[i] = goingDown[i]; + } + newBallPos[ballNumber] = randomPosition(); + newgl[ballNumber] = true; + newgr[ballNumber] = false; + newgu[ballNumber] = false; + newgu[ballNumber] = true; + ballPositions = newBallPos; + goingLeft = newgl; + goingRight = newgr; + goingUp = newgu; + goingDown = newgd; + ballNumber++; + } + + void seeIfBallHitWallFloorOrCeiling(int ballno) { + if (ballPositions[ballno].x <= 0) { // ball hit the left wall + goingRight[ballno] = true; + goingLeft[ballno] = false; + } + else if (ballPositions[ballno].y <= 0) {// ball hit the ceiling + goingUp[ballno]=false; + goingDown[ballno]=true; + } + else if (ballPositions[ballno].y >= BOTTOMEDGE-BALL_YAMOUNT) {// ball hit the floor + goingDown[ballno]=false; + goingUp[ballno]=true; + } + else if (ballPositions[ballno].x >= RIGHTEDGE) { // ball reached the right edge + deadball=true; + level--; // because it will be incremented in a minute and we want to stay on the same 'level' + ingame = false; + System.out.println("LOZER!"); + } + } + + private boolean isPlayerPosition(Point p) { + return(p.x >= playerPosition.x && + p.y >= playerPosition.y && + p.y <= playerPosition.y + 154); + } + + public void finished() { + finished = true; + System.exit(0); + } + + public String getAppletInfo() { + return ("Pong Game"); + } + + private Point moveBall(int ballno, Point original) { + Point result = new Point(original); + if (goingLeft[ballno]) result.x = result.x - BALL_XAMOUNT; + else if (goingRight[ballno]) result.x = result.x + BALL_XAMOUNT; + + if (goingUp[ballno]) result.y = result.y - BALL_YAMOUNT; + else if (goingDown[ballno]) result.y = result.y + BALL_YAMOUNT; + if (isPlayerPosition(result)) { + goingRight[ballno]=false; + goingLeft[ballno]=true; + } + else seeIfBallHitWallFloorOrCeiling(ballno); + return(result); + } + + // this class will use just the key pressed event + public void keyPressed(KeyEvent e) { + if (ingame) { + if (! + ((e.getKeyCode() == KeyEvent.VK_DOWN && playerPosition.y >= (BOTTOMEDGE - PLAYER_YAMOUNT)) || + (e.getKeyCode() == KeyEvent.VK_UP && playerPosition.y <= (TOPEDGE + PLAYER_YAMOUNT)))) { + // valid move: move the player and then move the balls + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + playerPosition.y += PLAYER_YAMOUNT; + } + else if (e.getKeyCode() == KeyEvent.VK_UP) { + playerPosition.y -= PLAYER_YAMOUNT; + } + for (int i=0; i < ballNumber; i++) { + if (isPlayerPosition(ballPositions[i])) { + goingRight[i]=false; + goingLeft[i]=true; + } + } + area.repaint(); + } // if valid key press + } + else if (e.getKeyCode() == KeyEvent.VK_ENTER) { + doLevel(level++); + } + } + + public void run() { + while (true) { + if (juststarted) { + try {Thread.sleep(750);} + catch (Exception e) {} + juststarted = false; + } + try {Thread.sleep(DELAY);} + catch (InterruptedException e){} + if (ingame) { + timeSinceLastBall += DELAY; + //System.out.println(String.valueOf(timeSinceLastBall)); + if (timeSinceLastBall >= 10000 ) { + addABall(); + timeSinceLastBall = 0; + } + // for each ball, move the ball closer to the player + for (int i=0; i < ballPositions.length; i++) { + if (!deadball) { + ballPositions[i] = moveBall(i, ballPositions[i]); + } + if (isPlayerPosition(ballPositions[i])) { + goingRight[i]=false; + goingLeft[i]=true; + } + } + area.repaint(); + } + } + } + + public void keyReleased(KeyEvent e) { + } + + public void keyTyped(KeyEvent e) { + } +} + diff --git a/Pong/Pong/java.policy.applet b/Pong/Pong/java.policy.applet @@ -0,0 +1,7 @@ +/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/ +/* DO NOT EDIT */ + +grant { + permission java.security.AllPermission; +}; + diff --git a/Pong/Pong/paddle.gif b/Pong/Pong/paddle.gif Binary files differ. diff --git a/Pong/java.policy.applet b/Pong/java.policy.applet @@ -0,0 +1,7 @@ +/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/ +/* DO NOT EDIT */ + +grant { + permission java.security.AllPermission; +}; + diff --git a/README.md b/README.md @@ -0,0 +1 @@ +# OldJavaGames diff --git a/Reaper.html b/Reaper.html @@ -0,0 +1,8 @@ +<HTML> +<HEAD> +<TITLE>Reaper Game</TITLE> +</HEAD> +<BODY> +<APPLET CODE="Reaper.ReaperGame.class" WIDTH=800 HEIGHT=600 X=200 Y=0></APPLET> +</BODY> +</HTML> diff --git a/Reaper/ReaperArea.java b/Reaper/ReaperArea.java @@ -0,0 +1,187 @@ +package Reaper; + +import java.awt.*; + +public class ReaperArea extends Panel { + + static int FLOORLEVEL = 589; + static final int FLOORWIDTH = 150; + static int FLOORDIFF = 605-FLOORLEVEL; + ReaperGame myApplet = null; + Image reaperwarp; + Image reaper1; + Image reaper1left; + Image reaper2; + Image reaper2left; + Image reapercrouch; + Image reapercrouchleft; + Image reaperjump; + Image reaperjumpleft; + Image obstacle; + Image tallobstacle; + Image reaperstand; + Image reaperstandleft; + Image levelcomplete; + Image reaperdead; + Image squishedrunner; + Image runner, runner2, runnerleft, runner2left; + Image title[] = new Image[10]; + MediaTracker mt=null; + boolean showingMessage = false; + boolean starting=true; + + public ReaperArea(ReaperGame parent) { + mt=new MediaTracker(parent); + myApplet = parent; + + runner = load(parent, "run1.gif"); + runnerleft = load(parent, "run1left.gif"); + runner2 = load(parent, "run2.gif"); + runner2left = load(parent, "run2left.gif"); + + squishedrunner = load(parent, "run1.gif"); + + reaper1 = load(parent, "grimreaper.gif"); + reaper1left = load(parent, "grimreaper.gif"); + reaper2 = load(parent, "grimreaper.gif"); + reaper2left = load(parent, "grimreaper.gif"); + reapercrouch = load(parent, "grimreaper.gif"); + reapercrouchleft = load(parent, "grimreaper.gif"); + reaperjump = load(parent, "grimreaper.gif"); + reaperjumpleft = load(parent, "grimreaper.gif"); + + obstacle = load(parent, "fire hydrant.gif"); + tallobstacle = load(parent, "bus.gif"); + reaperstand = load(parent, "grimreaper.gif"); + reaperstandleft = load(parent, "grimreaper.gif"); + + levelcomplete = load(parent, "missioncomplete.gif"); + reaperdead = load(parent, "reaperdead.gif"); + reaperwarp = load(parent, "warp.gif"); + + title[0] = load(parent, "g.gif"); + title[1] = load(parent, "gr.gif"); + title[2] = load(parent, "gri.gif"); + title[3] = load(parent, "grim.gif"); + title[4] = load(parent, "grimr.gif"); + title[5] = load(parent, "grimre.gif"); + title[6] = load(parent, "grimrea.gif"); + title[7] = load(parent, "grimreap.gif"); + title[8] = load(parent, "grimreape.gif"); + title[9] = load(parent, "grimreaperwriting.gif"); + + } + + Image load(ReaperGame parent, String picture) { + Image im = parent.getImage(myApplet.getCodeBase(), "Reaper\\" + picture); + checkImage(im, picture); + return(im); + } + + void checkImage(Image image, String name) { + if (mt != null) { + mt.addImage(image,0); + try { + mt.waitForID(0,5000); + } + catch (InterruptedException ie) { + // nothing to do + } + if (mt.isErrorID(0)) System.out.println("Image Not found: "+name.toString()); + } + } + + public synchronized void paint (Graphics g) { + Image obstacleimage, preyimage; + if (myApplet == null) return; + final int w = getBounds().width; + final int h = getBounds().height; + g.setColor(Color.white); + g.fillRect(0, 0, w, FLOORLEVEL); // don't white wash the floor! + FontMetrics fm = getFontMetrics(getFont()); + + g.setColor(Color.black); + int asc = fm.getAscent() + 4; + + // paint the floor + if (myApplet.floors[myApplet.level-1] != null) { + for (int pos=0; pos < w; pos+=FLOORWIDTH) { + g.drawImage(myApplet.floors[myApplet.level-1],pos, FLOORLEVEL,Color.black, null); + } + } + if (!myApplet.juststarted) { + if (myApplet.obstaclePositions != null) { + myApplet.changePageIfNecessary(); + // show the obstacles from right to left (because obstacles have white space to their left but not their right) + for (int i=myApplet.obstacleNumber-1; i >= 0; i--) { + obstacleimage = myApplet.getObstacleImage(i); + if (myApplet.isTall[i]) obstacleimage = tallobstacle; // only one image for this for now + g.drawImage(obstacleimage, myApplet.obstaclePositions[i].x-(myApplet.page*myApplet.PAGEWIDTH), myApplet.obstaclePositions[i].y,Color.white, null); + } + } + + // show the prey + if (myApplet.preyPositions != null) { + for (int i=0; i < myApplet.preyNumber; i++) { + //if (!myApplet.preyDead[i]) { + preyimage = myApplet.getEnemyImage(i); + g.drawImage(preyimage, myApplet.preyPositions[i].x-(myApplet.page*myApplet.PAGEWIDTH), myApplet.preyPositions[i].y,null); + //} + } + } + + // draw Hero (on top of preceding images) + if (myApplet.playerPosition != null) { + // show the player + Image reapersimage = myApplet.getHeroImage(); + if (myApplet.reapercrouching) { + if (myApplet.reaperleft) + reapersimage = reapercrouchleft; + else + reapersimage = reapercrouch; + } + if (myApplet.jumping) { + if (myApplet.reaperleft) + reapersimage = reaperjumpleft; + else + reapersimage = reaperjump; + } + g.drawImage(reapersimage, myApplet.playerPosition.x-(myApplet.page*myApplet.PAGEWIDTH), myApplet.playerPosition.y,/*Color.white,*/ null); + } + } + + // draw warp image (on top of Hero) + if (myApplet.warpzone != null) { + // show the warp zone at the end of the level + g.drawImage(reaperwarp, myApplet.warpzone.x-(myApplet.page*myApplet.PAGEWIDTH), myApplet.warpzone.y,Color.white, null); + } + + if (myApplet.ingame == false && !myApplet.juststarted) { + if (myApplet.dead) { + // Reaper is dead (?!) + g.drawImage(reaperdead, myApplet.getBounds().width/2, getBounds().height/2,Color.white, null); + } + else { + // level complete + g.drawImage(levelcomplete, myApplet.getBounds().width/2, getBounds().height/2,Color.white, null); + } + showingMessage=true; + } + else + showingMessage = false; + if (starting) { + showTitle(g); + starting=false; + } + + myApplet.setSomethingChangedSinceRepaint(false); + } + + public void showTitle(Graphics g) { + for (int i = 0; i < 10; i++) { + g.drawImage(title[i], myApplet.getBounds().width/2, getBounds().height/2,Color.white, null); + try {Thread.sleep(50);} + catch (Exception e) {} + } + } +}+ \ No newline at end of file diff --git a/Reaper/ReaperFrame.java b/Reaper/ReaperFrame.java @@ -0,0 +1,10 @@ +package Reaper; + +import java.awt.Frame; + +public class ReaperFrame extends Frame { + + public ReaperFrame() { + setBounds(200, 200, 200, 150); + } +}+ \ No newline at end of file diff --git a/Reaper/ReaperGame.java b/Reaper/ReaperGame.java @@ -0,0 +1,827 @@ +//* Copyright (c) Mary Percival 2003 */ +/* Reaper game Created May 2003 */ + +package Reaper; + +import java.awt.*; +import java.awt.event.*; +import java.applet.*; + +public class ReaperGame extends Applet implements KeyListener, Runnable { + + boolean easymode = true; + static int MAXLEVEL = 1; + static int level = 1; + + // the levels so far are: + // 1 beginner level: 4 fire hydrants & 1 runner + + static int LEFT=1; + static int RIGHT=0; + // the next 2 constants are overridden in init once we know the screen size + static int RIGHTEDGE = 789; + static int BOTTOMEDGE = 900; + static int PAGEWIDTH=741; + + static Point IMAGESIZE=new Point(152,107); + static final int LEFTEDGE = 0; + static final int TOPEDGE = -10; + static int GROUNDLEVEL = 503; + static int startPosY; + static int JUMPAMOUNT=70; + static int BOUNCEAMOUNT=48; + static final int FALLAMOUNT=16; // amount he falls each time interval + static final int RISEAMOUNT=16; // amount he rises each time interval + static final int XAMOUNT=12; + + static final int X = 1; + static final int Y = 2; + static final int NOT=3; + static final int DELAY = 50; + + static final int OBSTACLEIMAGES = 1; // static obstacles - unlike reaper obstacles + static final int HEROIMAGES = 4; + static final int PREYIMAGES=3; + + // ---------------------------------------------------------------------------------------------- + // PREY TYPES + // ---------------------------------------------------------------------------------------------- + static final int PREYTYPES=1; // runner + static final int RUNNER=0; + + // prey positions (height) + static final int RUNNERHEIGHT =GROUNDLEVEL-20; + static int preyHeight[] = new int[PREYTYPES]; + + static final int preySize[] = {27}; + static final int preyTopSpace[] = { 4}; + + static final int SPACE_FROM_X_TO_REAPER=55; + static final int REAPERHEIGHT=86; + static final int REAPEROFFSET=21; + static final int REAPERCROUCHOFFSET=39; + static final int REAPERSTANDINGSIZE = 65; + static final int REAPERCROUCHINGSIZE = 45; + + static final int JUMPDURATION=5; + static final int SUPERJUMPDURATION=8; + static final int REAPERLEFTOFOBSTACLE = 45; // fudge factor because Reaper image is diff size to obstacle image + static final int REAPERRIGHTOFOBSTACLE = 10; // fudge factor because Reaper image is diff size to obstacle image + static final int PREYLEFTOFOBSTACLE = 33; // fudge factor for prey images + static final int PREYRIGHTOFOBSTACLE = 7; // >49 causes panic! + static final int REAPERLEFTOFPREY=73; + static final int REAPERRIGHTOFPREY=-23; + + static final int LEFTDOWN=0; + static final int RIGHTDOWN=1; + static final int DOWNDOWN=2; + static final int SPACEDOWN=3; + + static final int OBSTACLEHEIGHT=42; + static final int TALLOBSTACLEDIFF=28; + static final int OBSTACLEWIDTH=40; + int GROUNDDIFF=605-GROUNDLEVEL; + + // all member variables 'static' because shared with the prey action thread + static ReaperArea area; + Thread timer; + static boolean finished = false; + static boolean ingame = false; + static boolean juststarted = true; + static Point warpzone; + static int[] keysdown = new int[4]; + static Point[] preyPositions; + static Point playerPosition; + static Point[] obstaclePositions; + static boolean[] piranhaPopping; // one for each obstacle + static boolean[] hasPiranha; // one for each obstacle + static boolean[] isTall; // one for each obstacle + static int preyDirection[]; + static int preyNumber=1, preyRemaining=1, obstacleNumber=1; + static boolean reapercrouching = false; + static boolean onTheWayUp=false; + static boolean bouncing=false; + static boolean wasbouncing = false; + static boolean dead = false; + static int page = 0; + static int reaperImageNo = 0; + static int preyImageNo[]; + static int levellength=1482; + static Image[] reaperImages = new Image[HEROIMAGES]; + static Image[] obstacleImages = new Image[OBSTACLEIMAGES]; // obstacle, piranhapeep, piranha peepy etc + static Image[] squished = new Image[PREYTYPES]; // squished images for each prey type + static Image[][][] preyImages = new Image[PREYTYPES][2][PREYIMAGES]; // left right left right or whatever + static int obstacleImageNo[]; // what is the current image for obstacle n + static Image[][] preyImage = new Image[PREYTYPES][PREYIMAGES];// what is the current image for prey n? + static Image floors[] = new Image[MAXLEVEL]; + static int preyType[]; // what is the type of prey n? + static boolean preyDead[]; // is prey n dead? + static boolean reaperleft = false; + static boolean jumping = false; + static int preyMove[] = new int[PREYTYPES]; + boolean somethingChangedSinceRepaint=false; + + // ************************************************************* + public void init() { + + setLayout(null); + setBackground(Color.white); + + area = new ReaperArea(this); + add(area); + FontMetrics fm = getFontMetrics(getFont()); + RIGHTEDGE = (getBounds().width/XAMOUNT)*XAMOUNT +LEFTEDGE; + BOTTOMEDGE = getBounds().height - 1; + setVisible(true); + area.setBounds(0,0,getBounds().width,BOTTOMEDGE); + GROUNDLEVEL = getBounds().height-GROUNDDIFF; + startPosY = GROUNDLEVEL; + area.FLOORLEVEL = getBounds().height-area.FLOORDIFF; + area.setVisible(true); + + addKeyListener(this); + area.addKeyListener(this); + area.requestFocus(); + + for (int i=0; i < OBSTACLEIMAGES; i++) { + obstacleImages[i] = area.obstacle; + } + + preyImages[RUNNER][RIGHT][0] = area.runner; + preyImages[RUNNER][RIGHT][1] = area.runner2; + preyImages[RUNNER][LEFT][0] = area.runnerleft; + preyImages[RUNNER][LEFT][1] = area.runner2left; + + preyMove[RUNNER] = 5; + preyHeight[RUNNER] = 40; + squished[RUNNER] = area.squishedrunner; + + //for (int i=0; i < MAXLEVEL; i++) { + // floors[i] = area.floor4; + //} + + timer = new Thread(this); + timer.start(); + + } + + public void start() { + // called by Applet Viewer or Browser + doLevel(level); + } + + synchronized void faceRight() { + reaperImages[0] = area.reaperstand; + reaperImages[1] = area.reaper1; + reaperImages[2] = area.reaperstand; + reaperImages[3] = area.reaper2; + reaperImageNo = 0; + reaperleft=false; + } + + synchronized void faceLeft() { + reaperImages[0] = area.reaperstandleft; + reaperImages[1] = area.reaper1left; + reaperImages[2] = area.reaperstandleft; + reaperImages[3] = area.reaper2left; + reaperImageNo = 0; + reaperleft=true; + } + + synchronized void preyFaceRight(int preyno) { + preyImage[preyno][0] = preyImages[preyType[preyno]][RIGHT][0]; + preyImage[preyno][1] = preyImages[preyType[preyno]][RIGHT][1]; + preyDirection[preyno] = RIGHT; + } + + synchronized void preyFaceLeft(int preyno) { + preyImage[preyno][0] = preyImages[preyType[preyno]][LEFT][0]; + preyImage[preyno][1] = preyImages[preyType[preyno]][LEFT][1]; + preyDirection[preyno] = LEFT; + } + + synchronized void preyDie(int preyno) { + //displayStatus(); + preyImage[preyno][0] = squished[preyType[preyno]]; + preyImage[preyno][1] = squished[preyType[preyno]]; + } + + synchronized void standStill() { + reaperImageNo = 0; + } + + public void doLevel(int level) { + // this runs one 'level' + juststarted = true; + Point temppoint; + dead = false; + + // position reaper at the bottom left + playerPosition = new Point(LEFTEDGE,GROUNDLEVEL); + faceRight(); + + + // *********** THIS STUFF DEPENDS WHAT LEVEL YOU ARE ON ************ + switch (level) { + case 1: + obstacleNumber=4; // 4 obstacles for level 1 + preyNumber = 1; + levellength = 1482; // 2 pages + break; + default: + System.out.println("Level " + level + " has not yet been implemented"); + } + preyImage = new Image[preyNumber][PREYIMAGES];// what is the current image for prey n? + // initialise piranha states + obstacleImageNo = new int[obstacleNumber]; + hasPiranha = new boolean[obstacleNumber]; + piranhaPopping = new boolean[obstacleNumber]; + isTall = new boolean[obstacleNumber]; + + // initialise the arrays of prey, etc + preyPositions = new Point[preyNumber]; + preyType = new int[preyNumber]; + preyDead = new boolean[preyNumber]; + obstaclePositions = new Point[obstacleNumber]; + preyDirection = new int[preyNumber]; + preyImageNo = new int[preyNumber]; + + for (int i=0; i < preyNumber; i++) { + preyImageNo[i] = 0; + } + + switch (level) { + // ----------------------------------------------- + // LEVEL 1 + // ----------------------------------------------- + case 1: + for (int i=0; i < obstacleNumber; i++) { + isTall[i] = false; + piranhaPopping[i] = false; + hasPiranha[i] = false; + } + obstaclePositions[0] = new Point(400, GROUNDLEVEL); + obstaclePositions[1] = new Point(950, GROUNDLEVEL); + obstaclePositions[2] = new Point(1245, GROUNDLEVEL); //1255 for adjacent + obstaclePositions[3] = new Point(1320, GROUNDLEVEL); + + preyPositions[0] = new Point(1000, RUNNERHEIGHT); + preyType = new int[] {RUNNER}; + break; + // ----------------------------------------------- + // LEVEL 2 + // ----------------------------------------------- + default: + + } + + for (int j=0; j < preyNumber; j++) { + preyFaceRight(j); // in this game all the 'prey' are fleeing to the right + preyDead[j] = false; + } + + for (int i=0; i < obstacleNumber; i++) { + if (hasPiranha[i]) { // pick a random image number between 0 and 18 (inclusive) + obstacleImageNo[i] = (int) (Math.random() * 18) / 1; + } + else obstacleImageNo[i] = 0; + } + + // position the warp zone at the end of the level + warpzone = new Point(levellength, GROUNDLEVEL); + // *********** END OF STUFF THAT DEPENDS WHAT LEVEL YOU ARE ON ************ + + ingame = true; + showStatus("Started level " + level); + } + + boolean isPlayerPosition(Point p) { + return(p.x == playerPosition.x && p.y == playerPosition.y); + } + + int isEnemyPosition(Point p) { + for (int i = 0 ; i < preyNumber; i++) { + if(isEnemyX(p) != -1 && isEnemyY(p) != -1 && !preyDead[i]) return(i); + } + return(-1); + } + + boolean isObstaclePosition(Point p, boolean forReaper) { + int obby; + for (int i = 0 ; i < obstacleNumber; i++) { + obby = isObstacleX(p, forReaper); + if(obby != -1 && isObstacleY(p, obby, forReaper) != -1) { + return(true); + } + } + return(false); + } + + boolean checkIfBlockingObstacle(Point p) { + boolean result = false; + int obby, obby2; + obby = isObstacleX(p, true); + if(obby != -1 && isBlockingObstacleY(p, obby)) { + piranhaPopping[obby] = false; + result = true; + } + for (int i = 0 ; i < obstacleNumber; i++) { + if (i != obby || !result) { + if (hasPiranha[i]) piranhaPopping[i] = true; + } + } + if (!result) startPosY = GROUNDLEVEL; + return(result); + } + + int isObstacleX(Point p, boolean forReaper) { + int obstaclex; + for (int i = 0 ; i < obstacleNumber; i++) { + // if x is >= obstacleposition - (REAPERLEFTOFOBSTACLE) and x <= obstacleposition + (REAPERRIGHTOFOBSTACLE) + obstaclex = obstaclePositions[i].x; + if (forReaper) { + if(p.x >= (obstaclex - REAPERLEFTOFOBSTACLE) && p.x <= (obstaclex + REAPERRIGHTOFOBSTACLE)) + return(i); // return the number of the matching obstacle + } + else { + if(p.x >= (obstaclex - PREYLEFTOFOBSTACLE) && p.x <= (obstaclex + PREYRIGHTOFOBSTACLE)) + return(i); // return the number of the matching obstacle + } + } + return(-1); + } + + boolean isBlockingObstacleY(Point p, int obstaclenumber) { + String s = "Is Reaper blocking obstacle " + obstaclenumber + " which is " + (isTall[obstaclenumber] ? "" : "not ") + "tall"; + if (isTall[obstaclenumber]) { + if(p.y <= obstaclePositions[obstaclenumber].y-(OBSTACLEHEIGHT+TALLOBSTACLEDIFF)) { + //System.out.println(s+": Yes"); + return(true); + } + } + else { + if(p.y <= obstaclePositions[obstaclenumber].y-OBSTACLEHEIGHT) { + //System.out.println(s+": Yes"); + return(true); + } + } + //System.out.println(s+": No"); + return(false); + } + + int isObstacleY(Point p, int obstaclenumber, boolean forReaper) { + if (isTall[obstaclenumber]) { + if(p.y > obstaclePositions[obstaclenumber].y-(OBSTACLEHEIGHT+TALLOBSTACLEDIFF)) { + return(obstaclenumber); + } + } + else { + if(p.y > obstaclePositions[obstaclenumber].y-OBSTACLEHEIGHT) { + return(obstaclenumber); + } + } + return(-1); + } + + int isEnemyX(Point p) { + int preyx; + for (int i = 0 ; i < preyNumber; i++) { + // if x is >= preyposition - (LEFTOFPREY) and x <= preyposition + (RIGHTOFPREY) + preyx = preyPositions[i].x; + //System.out.println("Player got by prey if " + + // p.x + " >= " + (preyx - REAPERLEFTOFPREY) + " && " + p.x + " <= " + (preyx + REAPERRIGHTOFPREY)); + if(p.x >= (preyx - REAPERLEFTOFPREY) && p.x <= (preyx + REAPERRIGHTOFPREY) && !preyDead[i]) + return(i); // return the number of the matching prey + } + return(-1); + } + + int isEnemyY(Point p) { + int offset = reapercrouching ? REAPERCROUCHOFFSET : REAPEROFFSET; + for (int i = 0 ; i < preyNumber; i++) { + if(!preyDead[i] && + ((p.y+offset <= preyPositions[i].y+preySize[preyType[i]]) && + (p.y+REAPERHEIGHT) >= preyPositions[i].y)) + return(i); + } + return(-1); + } + + public void finished() { + finished = true; + System.exit(0); + } + + public String getAppletInfo() { + return ("Reaper Game"); + } + + int randomMove() { + // return + or - value (randomly) + if (Math.random() >= 0.5) return(24); + else return(-24); + } + + private synchronized void incKeysDown(int whichone) { + keysdown[whichone] = 1; + } + + private synchronized void decKeysDown(int whichone) { + keysdown[whichone] = 0; + } + + // this class will use just the key pressed event + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_F1) { + displayStatus(); + } + if (ingame) { + if (! + (e.getKeyCode() == KeyEvent.VK_LEFT && playerPosition.x <= (LEFTEDGE + XAMOUNT))) { + + // valid move: move the player and then move the prey + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + reapercrouching = true; + incKeysDown(DOWNDOWN); + setSomethingChangedSinceRepaint(true); + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + incKeysDown(LEFTDOWN); + leftPressed(false); + setSomethingChangedSinceRepaint(true); + } + else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + incKeysDown(RIGHTDOWN); + rightPressed(false); + setSomethingChangedSinceRepaint(true); + } + else if (e.getKeyCode() == KeyEvent.VK_SPACE) { + if (!jumping) { + startPosY = playerPosition.y; + jumping = true; + onTheWayUp=true; + setSomethingChangedSinceRepaint(true); + } + } + if (somethingChangedSinceRepaint) { + area.repaint(); + } + } // if valid key press + } + else if (e.getKeyCode() == KeyEvent.VK_ENTER) { + if (level == MAXLEVEL || dead) doLevel(level); + else doLevel(++level); + page=0; + area.repaint(); + } + } + + /*synchronized*/ void setSomethingChangedSinceRepaint(boolean val) { + somethingChangedSinceRepaint = val; + } + + void leftPressed(boolean skid) { + if (!reapercrouching) { + // if Hero was facing right, turn him left + if (!reaperleft) + faceLeft(); + else { + // if the target position is not occupied by a obstacle... + for (int i=0; i < obstacleNumber; i++) { + if (isObstaclePosition(new Point(playerPosition.x-XAMOUNT, playerPosition.y), true)) + return; // can't move + } + playerPosition.x -= XAMOUNT; + if (!skid) incrementHeroImage(); + } + } + } + + void rightPressed(boolean skid) { + if (!reapercrouching) { + if ((playerPosition.x + SPACE_FROM_X_TO_REAPER) >= (warpzone.x+4)) { + // level complete! + ingame=false; + } + else { + // if Hero was facing left, turn him right + if (reaperleft) + faceRight(); + else { + for (int i=0; i < obstacleNumber; i++) { + if (isObstaclePosition(new Point(playerPosition.x+XAMOUNT, playerPosition.y), true)) + return; // can't move + } + playerPosition.x += XAMOUNT; + //System.out.println("Reaper's x position is " + playerPosition.x); + if (!skid) incrementHeroImage(); + } + } + } + } + + boolean anythingVisibleChanged() { + return(somethingChangedSinceRepaint); + } + + public void run() { + boolean odd=true; // only change piranha image every other cycle + while (true) { + if (juststarted) { + try {Thread.sleep(750);} + catch (Exception e) {} + area.repaint(); + juststarted = false; + } + try {Thread.sleep(DELAY);} + catch (InterruptedException e){} + if (ingame) { + if (keysdown[LEFTDOWN] == 0 && + keysdown[RIGHTDOWN] == 0 && + keysdown[DOWNDOWN] == 0) standStill(); + + if (keysdown[LEFTDOWN] > 0) { + leftPressed(false); + setSomethingChangedSinceRepaint(true); + } + else if (keysdown[RIGHTDOWN] > 0) { + rightPressed(false); + setSomethingChangedSinceRepaint(true); + } + + if (!odd) { + // for each obstacle, cycle through the piranha pictures + for (int i=0; i < obstacleNumber; i++) { + if (piranhaPopping[i]) { + incrementObstacleImage(i); + if (isVisibleObstacle(i)) setSomethingChangedSinceRepaint(true); + } + } + } + odd = !odd; + + // for each prey, move the prey in the direction it was going + for (int i=0; i < preyNumber; i++) { + // TODO if there is a fatal obstacle at that position, fall into it and decrement count of prey + // and set that prey's position to -1, -1 + /* + if (isObstaclePosition(preyPositions[i])) { + showStatus("A prey fell into a obstacle"); + + preyPositions[i] = new Point(-1, -1); + preyRemaining--; + showStatus(preyNumber-preyRemaining + " down, " + preyRemaining + " to go..."); + } + */ + // if there is a non-fatal obstacle + if (isObstaclePosition(preyPositions[i],false)) { + // change direction + changeDirection(i); + if (isVisibleEnemy(i)) setSomethingChangedSinceRepaint(true); + } + if (!preyDead[i]) { + preyPositions[i] = move(i, preyPositions[i], preyDirection[i], odd); + if (isVisibleEnemy(i)) setSomethingChangedSinceRepaint(true); + } + + // if player is caught by a prey, end the game + int preyno = isEnemyPosition(playerPosition); + if (preyno > -1) { + int NEEDTOBEABOVE = preyPositions[preyno].y+preyTopSpace[preyno]-REAPERHEIGHT; + if (easymode) NEEDTOBEABOVE = preyPositions[preyno].y-preyHeight[preyType[preyno]]; + if ((!onTheWayUp && (playerPosition.y <=NEEDTOBEABOVE))) { + // player may have squished an prey + preyDead[preyno]=true; + preyDie(preyno); + // player bounces + bouncing = true; + startPosY = playerPosition.y; + setSomethingChangedSinceRepaint(true); + } + else { + int offset = reapercrouching ? REAPERCROUCHOFFSET : REAPEROFFSET; + if (playerPosition.y > NEEDTOBEABOVE && + (playerPosition.y+offset <= preyPositions[preyno].y+preySize[preyType[preyno]])) { + die(); + setSomethingChangedSinceRepaint(true); + } + } + } + } + if (!dead) { + if (onTheWayUp) { + if (playerPosition.y > startPosY-JUMPAMOUNT) { + playerPosition = new Point(playerPosition.x, playerPosition.y - RISEAMOUNT); + setSomethingChangedSinceRepaint(true); + } + else { + onTheWayUp=false; + } + } + else if (bouncing) { + if (playerPosition.y > startPosY-BOUNCEAMOUNT) { + playerPosition = new Point(playerPosition.x, playerPosition.y - RISEAMOUNT); + setSomethingChangedSinceRepaint(true); + } + else { + bouncing=false; + wasbouncing = true; + } + } + else { + int obstacleno = isObstacleX(playerPosition, true); + if (obstacleno == -1) { // no obstacle at this position + if (!onTheWayUp && !bouncing) { + if (playerPosition.y < startPosY) { + playerPosition = new Point(playerPosition.x, playerPosition.y+FALLAMOUNT); + wasbouncing = false; + setSomethingChangedSinceRepaint(true); + } + else jumping = false; + } + } + else { + Point obstaclepos = obstaclePositions[obstacleno]; + // if reaper's y position <= obstacle's height + int thisObstacleHeight = isTall[obstacleno] ? OBSTACLEHEIGHT+TALLOBSTACLEDIFF : OBSTACLEHEIGHT; + if (playerPosition.y <= (obstaclepos.y-thisObstacleHeight) && // can't land on the obstacle if just < (??!) + (playerPosition.y+FALLAMOUNT >= (obstaclepos.y-thisObstacleHeight)) + ) { + // allow reaper to land on the obstacle + jumping=false; + if (playerPosition.y != obstaclepos.y-thisObstacleHeight) setSomethingChangedSinceRepaint(true); + playerPosition = new Point(playerPosition.x, obstaclepos.y-thisObstacleHeight); + // if the piranha was up, Hero dies + if (obstacleImages[obstacleImageNo[obstacleno]] != area.obstacle) { + die(); + } + else { + // otherwise stop this Piranha + piranhaPopping[obstacleno] = false; + } + } + else { + if (!onTheWayUp && !bouncing) { + if (playerPosition.y < startPosY) { + setSomethingChangedSinceRepaint(true); + playerPosition = new Point(playerPosition.x, playerPosition.y+FALLAMOUNT); + wasbouncing = false; + } + else jumping = false; + } + } + } + } + if (!dead) { + checkIfBlockingObstacle(playerPosition); + if (playerPosition.y > GROUNDLEVEL) playerPosition.y = GROUNDLEVEL; + } + if (anythingVisibleChanged()) { + area.repaint(); + } + } + else { + if (!area.showingMessage) + area.repaint(); + } + } + } + } + + boolean isVisibleObstacle(int i) { + // TODO - this probably needs fixing when obstacle is near page boundary + return ((obstaclePositions[i].x >= page*PAGEWIDTH) && + (obstaclePositions[i].x < (page+1)*PAGEWIDTH)); + } + + boolean isVisibleEnemy(int i) { + // TODO - this probably needs fixing when prey is near page boundary + return ((preyPositions[i].x >= page*PAGEWIDTH) && + (preyPositions[i].x < (page+1)*PAGEWIDTH) && !preyDead[i]); + } + + void changeDirection(int preyno) { + if (preyDirection[preyno] == LEFT) { + preyFaceRight(preyno); + } + else { + preyFaceLeft(preyno); + } + } + + synchronized void die() { + showStatus("The Player is dead. Press the Enter key to restart the level"); + ingame=false; + dead = true; + displayStatus(); + } + + synchronized void incrementObstacleImage(int i) { + obstacleImageNo[i]++; + if (obstacleImageNo[i] == OBSTACLEIMAGES) obstacleImageNo[i] = 0; + } + + synchronized void incrementHeroImage() { + reaperImageNo++; + if (reaperImageNo == HEROIMAGES) reaperImageNo = 0; + } + + synchronized void incrementEnemyImage(int i) { + preyImageNo[i]++; + if (preyImageNo[i] > (PREYIMAGES-2) ) preyImageNo[i] = 0; + } + + Point move(int preyNo, Point start, int direction, boolean odd) { + if (odd) incrementEnemyImage(preyNo); + if (direction == LEFT) { + return(new Point(start.x -preyMove[preyType[preyNo]], start.y)); + } + else { + return(new Point(start.x +preyMove[preyType[preyNo]], start.y)); + } + } + + public void keyReleased(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + reapercrouching = false; + decKeysDown(DOWNDOWN); + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + decKeysDown(LEFTDOWN); + } + else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + decKeysDown(RIGHTDOWN); + } + } + + public void keyTyped(KeyEvent e) { + } + + synchronized Image getHeroImage() { + return(reaperImages[reaperImageNo]); + } + + synchronized Image getObstacleImage(int obstaclenum) { + return(obstacleImages[obstacleImageNo[obstaclenum]]); + } + + synchronized Image getEnemyImage(int preyno) { + return(preyImage[preyno][preyImageNo[preyno]]); + } + + void displayStatus() { + /* + // when a certain F Key is pressed, display positions of Reaper, + // all obstacles and all prey and the end flag (warp zone) + System.out.println("--------"); + System.out.println("Reaper is " + (dead? "dead" : "alive")); + if (dead) { + int preyno = isEnemyPosition(playerPosition); + System.out.println("Reaper was killed by prey " + preyno); + } + System.out.println("In game is " + ingame); + System.out.println("Reaper is " + (onTheWayUp? "on the way up" : "not on the way up")); + System.out.println("Reaper's position is (" + playerPosition.x + ", " + playerPosition.y + ")"); + System.out.println("Reaper's visible left, bottom co-ordinates are " + (playerPosition.x + 55) + " and " + (playerPosition.y + REAPERHEIGHT)); + System.out.println("Reaper is on page " + page + " (which shows x positions from " + (page*PAGEWIDTH) + " to " + ((page+1)*PAGEWIDTH) + ")"); + System.out.println("Screen bounds are (" + getBounds().width + ", " + getBounds().height + ")"); + System.out.println(""); + for (int prey=0; prey < preyNumber; prey++) { + System.out.println("Enemy " + prey + " is " + preyTypeString(preyType[prey]) + " and is " + + (preyDead[prey] ? " " : "not ") + "dead"); + System.out.println("Enemy " + prey + " is at position (" + preyPositions[prey].x + + ", " + preyPositions[prey].y+") and has size " + preySize[preyType[prey]]); + } + //System.out.println(""); + //for (int obstacle=0; obstacle < obstacleNumber; obstacle++) { + // System.out.println("Obstacle " + obstacle + " is at position (" + obstaclePositions[obstacle].x + + // ", " + obstaclePositions[obstacle].y+")"); + //} + System.out.println(""); + System.out.println("The warp zone is positioned at (" + warpzone.x + ", " + warpzone.y + ")"); + System.out.println("========"); + */ + } + + String preyTypeString(int fortype) { + switch (fortype) { + case RUNNER: + return("RUNNER"); + default: + return("Unknown type (" + fortype + ")"); + } + } + + void changePageIfNecessary() { + if (playerPosition.x == LEFTEDGE) return; + if ((playerPosition.x+SPACE_FROM_X_TO_REAPER) > (page*PAGEWIDTH+RIGHTEDGE-XAMOUNT)) { + //System.out.println("Change page up: (" + playerPosition.x+ "+" + SPACE_FROM_X_TO_REAPER+ ") > (" + page+ "*" + PAGEWIDTH + "+" + RIGHTEDGE + "-" + XAMOUNT + ")"); + page++; + } + else if ((playerPosition.x+SPACE_FROM_X_TO_REAPER)-(page*PAGEWIDTH) < (LEFTEDGE+XAMOUNT)) { + //System.out.println("Change page down: (" + playerPosition.x+ "+" + SPACE_FROM_X_TO_REAPER+ ")-(" + page+ "*" + PAGEWIDTH + ") < (" + LEFTEDGE+ "+" + XAMOUNT+")"); + page--; + } + } +} + diff --git a/Reaper/bod.gif b/Reaper/bod.gif Binary files differ. diff --git a/Reaper/bunny.gif b/Reaper/bunny.gif Binary files differ. diff --git a/Reaper/bus.gif b/Reaper/bus.gif Binary files differ. diff --git a/Reaper/fire hydrant.gif b/Reaper/fire hydrant.gif Binary files differ. diff --git a/Reaper/g.gif b/Reaper/g.gif Binary files differ. diff --git a/Reaper/gr.gif b/Reaper/gr.gif Binary files differ. diff --git a/Reaper/gri.gif b/Reaper/gri.gif Binary files differ. diff --git a/Reaper/grim.gif b/Reaper/grim.gif Binary files differ. diff --git a/Reaper/grimr.gif b/Reaper/grimr.gif Binary files differ. diff --git a/Reaper/grimre.gif b/Reaper/grimre.gif Binary files differ. diff --git a/Reaper/grimrea.gif b/Reaper/grimrea.gif Binary files differ. diff --git a/Reaper/grimreap.gif b/Reaper/grimreap.gif Binary files differ. diff --git a/Reaper/grimreape.gif b/Reaper/grimreape.gif Binary files differ. diff --git a/Reaper/grimreaper.gif b/Reaper/grimreaper.gif Binary files differ. diff --git a/Reaper/grimreaperenemydeafeat.gif b/Reaper/grimreaperenemydeafeat.gif Binary files differ. diff --git a/Reaper/grimreaperenemydeafeat2.gif b/Reaper/grimreaperenemydeafeat2.gif Binary files differ. diff --git a/Reaper/grimreaperwriting.gif b/Reaper/grimreaperwriting.gif Binary files differ. diff --git a/Reaper/missioncomplete.gif b/Reaper/missioncomplete.gif Binary files differ. diff --git a/Reaper/one two.gif b/Reaper/one two.gif Binary files differ. diff --git a/Reaper/paddle.gif b/Reaper/paddle.gif Binary files differ. diff --git a/Reaper/reaperdead.gif b/Reaper/reaperdead.gif Binary files differ. diff --git a/Reaper/rsqr.gif b/Reaper/rsqr.gif Binary files differ. diff --git a/Reaper/rsqrfon.gif b/Reaper/rsqrfon.gif Binary files differ. diff --git a/Reaper/rsqrkickfon.gif b/Reaper/rsqrkickfon.gif Binary files differ. diff --git a/Reaper/run1.gif b/Reaper/run1.gif Binary files differ. diff --git a/Reaper/run1left.gif b/Reaper/run1left.gif Binary files differ. diff --git a/Reaper/run2.gif b/Reaper/run2.gif Binary files differ. diff --git a/Reaper/run2left.gif b/Reaper/run2left.gif Binary files differ. diff --git a/Reaper/two two.gif b/Reaper/two two.gif Binary files differ. diff --git a/Reaper/warp.gif b/Reaper/warp.gif Binary files differ. diff --git a/Tank.html b/Tank.html @@ -0,0 +1,8 @@ +<HTML> +<HEAD> +<TITLE>Tank Game</TITLE> +</HEAD> +<BODY> +<APPLET CODE="Tank.TankGame.class" WIDTH=800 HEIGHT=600 X=200 Y=0></APPLET> +</BODY> +</HTML> diff --git a/Tank/TankArea.java b/Tank/TankArea.java @@ -0,0 +1,151 @@ +package Tank; + +import java.awt.*; + +public class TankArea extends Panel { + TankGame myApplet = null; + +Image badtankdown2; +Image badtankdownshoot; +Image badtankdownshoot2; +Image badtankdown; +Image badtankleft2; +Image badtankleftshoot2; +Image badtankleftshoot; +Image badtankleft ; +Image badtankright2; +Image badtankrightshoot2; +Image badtankrightshoot; +Image badtankright; +Image badtankup2; +Image badtankupshoot2; +Image badtankupshoot; +Image badtankup; +Image tankdown2; +Image tankdownshoot2; +Image tankdownshoot; +Image tankdown; +Image tankleft2; +Image tankleftshoot2; +Image tankleftshoot; +Image tankleft; +Image tankright2; +Image tankrightshoot2; +Image tankrightshoot; +Image tankright; +Image tankup2; +Image tankupshoot2; +Image tankupshoot; +Image tankup; +Image enemyImage; +Image personImage; +Image pitImage; + + private Image explosion1, explosion2, explosion3; + MediaTracker mt=null; + + public TankArea(TankGame parent) { + myApplet = parent; + enemyImage = load(myApplet, "bad-tank-up.gif"); + personImage = load(myApplet, "tank-up.gif"); + pitImage = load(myApplet, "pit.gif"); + explosion1 = load(myApplet, "explosion1.gif"); + explosion2 = load(myApplet, "explosion2.gif"); + explosion3 = load(myApplet, "explosion3.gif"); + badtankdown2 = load(myApplet, "bad-tank-down-2.gif"); + badtankdownshoot = load(myApplet, "bad-tank-down-shoot.gif"); + badtankdownshoot2 = load(myApplet, "bad-tank-down-shoot-2.gif"); + badtankdown = load(myApplet, " bad-tank-down.gif"); + badtankleft2 = load(myApplet, "bad-tank-left-2.gif"); + badtankleftshoot2 = load(myApplet, "bad-tank-left-shoot-2.gif"); + badtankleftshoot = load(myApplet, "bad-tank-left-shoot.gif"); + badtankleft = load(myApplet, "bad-tank-left.gif"); + badtankright2 = load(myApplet, "bad-tank-right-2.gif"); + badtankrightshoot2 = load(myApplet, "bad-tank-right-shoot-2.gif"); + badtankrightshoot = load(myApplet, "bad-tank-right-shoot.gif"); + badtankright = load(myApplet, "bad-tank-right.gif"); + badtankup2 = load(myApplet, "bad-tank-up-2.gif"); + badtankupshoot2 = load(myApplet, "bad-tank-up-shoot-2.gif"); + badtankupshoot = load(myApplet, "bad-tank-up-shoot.gif"); + badtankup = load(myApplet, "bad-tank-up.gif"); + tankdown2 = load(myApplet, "tank-down-2.gif"); + tankdownshoot2 = load(myApplet, "tank-down-shoot-2.gif"); + tankdownshoot = load(myApplet, "tank-down-shoot.gif"); + tankdown = load(myApplet, "tank-down.gif"); + tankleft2= load(myApplet, "tank-left-2.gif"); + tankleftshoot2 = load(myApplet, "tank-left-shoot-2.gif"); + tankleftshoot = load(myApplet, "tank-left-shoot.gif"); + tankleft = load(myApplet, "tank-left.gif"); + tankright2 = load(myApplet, "tank-right-2.gif"); + tankrightshoot2 = load(myApplet, "tankright-shoot-2.gif"); + tankrightshoot = load(myApplet, "tank-right-shoot.gif"); + tankright = load(myApplet, "tank-right.gif"); + tankup2 = load(myApplet, "tank-up-2.gif"); + tankupshoot2 = load(myApplet, "tank-up-shoot-2.gif"); + tankupshoot = load(myApplet, "tank-up-shoot.gif"); + tankup = load(myApplet, "tank-up.gif"); + } + + Image load(TankGame parent, String picture) { + Image im = parent.getImage(myApplet.getCodeBase(), "Tank\\" + picture); + checkImage(im, picture); + return(im); + } + + void checkImage(Image image, String name) { + if (mt != null) { + mt.addImage(image,0); + try { + mt.waitForID(0,5000); + } + catch (InterruptedException ie) { + // nothing to do + } + if (mt.isErrorID(0)) System.out.println("Image Not found: "+name.toString()); + } + } + + public void paint (Graphics g) { + if (myApplet == null) return; + final int w = getBounds().width; + final int h = getBounds().height; + g.setColor(Color.gray); + g.fillRect(0, 0, w, h); + FontMetrics fm = getFontMetrics(getFont()); + + g.setColor(Color.black); + int asc = fm.getAscent() + 4; + + if (myApplet.playerPosition != null) { + // show the player + //g.drawString("#", myApplet.playerPosition.x, myApplet.playerPosition.y); + int elem = myApplet.shooting ? myApplet.SHOOTING : myApplet.NOTSHOOTING; + g.drawImage(myApplet.goodImages[myApplet.goodImageNo][elem], myApplet.playerPosition.x, myApplet.playerPosition.y,Color.gray, null); + + // show the pits + for (int i=0; i < myApplet.pitPositions.length; i++) { + g.drawImage(pitImage, myApplet.pitPositions[i].x, myApplet.pitPositions[i].y,Color.gray, null); + } + + // show the enemies + for (int i=0; i < myApplet.enemyPositions.length; i++) { + if (myApplet.enemyPositions[i].x > -1) { + int eelem = myApplet.enemyShooting[i] ? myApplet.SHOOTING : myApplet.NOTSHOOTING; + g.drawImage(myApplet.badImages[myApplet.enemyImageNo[i]][eelem], myApplet.enemyPositions[i].x, myApplet.enemyPositions[i].y,null); + } + } + if (myApplet.explosionx != -1) { + g.drawImage(explosion1, myApplet.explosionx, myApplet.explosiony,Color.gray, null); + try { + Thread.sleep(80); + g.drawImage(explosion2, myApplet.explosionx, myApplet.explosiony,Color.gray, null); + Thread.sleep(80); + g.drawImage(explosion3, myApplet.explosionx, myApplet.explosiony,Color.gray, null); + } + catch (Exception e) {} + myApplet.explosionx = -1; + myApplet.explosiony=-1; + } + } + } +}+ \ No newline at end of file diff --git a/Tank/TankFrame.java b/Tank/TankFrame.java @@ -0,0 +1,10 @@ +package Tank; + +import java.awt.Frame; + +public class TankFrame extends Frame { + + public TankFrame() { + setBounds(200, 200, 200, 150); + } +}+ \ No newline at end of file diff --git a/Tank/TankGame.java b/Tank/TankGame.java @@ -0,0 +1,452 @@ +/* Copyright (c) Mary Percival 2002 */ +/* Tank game Created October 2002 */ + +package Tank; + +import java.awt.*; +import java.awt.event.*; +import java.applet.*; + +public class TankGame extends Applet implements KeyListener, Runnable { + // all member variables 'static' because shared with the enemy action thread + private static TankArea area; + private static boolean finished = false; + private static boolean ingame = false; + private boolean juststarted = false; + private static int level = 1; + private static int enemiesRemaining; + protected static Point[] enemyPositions; + protected static Point playerPosition; + protected static Point[] pitPositions; + private Thread enemies; + + protected static int pitNumber = 15; + protected static int enemyNumber = 1; + protected static int RIGHTEDGE = 1200; + protected static final int LEFTEDGE = 0; + protected static final int TOPEDGE = 0; + protected static int BOTTOMEDGE = 1000; + protected static int XAMOUNT=5; + protected static int YAMOUNT=5; + private static final int X = 1; + private static final int Y = 2; + private static final int NOT=3; + private static final int DELAY = 125; + protected int explosionx =-1, explosiony=-1; + + // tank game stuff + boolean up=true, down=false, left=false, right=false, shooting=false; + int NOTSHOOTING=0, SHOOTING=1, FIRSTUP=0, FIRSTDOWN=2, FIRSTLEFT=4, FIRSTRIGHT=6; + int goodImageNo=FIRSTUP; // TODO - randomise + int[] enemyImageNo; + boolean[] enemyShooting; + Image[][] goodImages = new Image[8][2]; // up up2 down down2 left left2 right right2 x SHOOTING and NON_SHOOTING + Image[][] badImages = new Image[8][2]; // up up2 down down2 left left2 right right2 x SHOOTING and NON_SHOOTING + + public void init() { + + setLayout(null); + setBackground(Color.gray); + + area = new TankArea(this); + add(area); + FontMetrics fm = getFontMetrics(getFont()); + RIGHTEDGE = getBounds().width - 1; + BOTTOMEDGE = getBounds().height - 1; + XAMOUNT = 12; + YAMOUNT = 12; + setVisible(true); + area.setBounds(0,0,RIGHTEDGE,BOTTOMEDGE); + area.setVisible(true); + + addKeyListener(this); + area.addKeyListener(this); + area.requestFocus(); + + goodImages[FIRSTUP][NOTSHOOTING] = area.tankup; + goodImages[FIRSTUP+1][NOTSHOOTING] = area.tankup2; + goodImages[FIRSTUP][SHOOTING] = area.tankupshoot; + goodImages[FIRSTUP+1][SHOOTING] = area.tankupshoot2; + + goodImages[FIRSTDOWN][NOTSHOOTING] = area.tankdown; + goodImages[FIRSTDOWN+1][NOTSHOOTING] = area.tankdown2; + goodImages[FIRSTDOWN][SHOOTING] = area.tankdownshoot; + goodImages[FIRSTDOWN+1][SHOOTING] = area.tankdownshoot2; + + goodImages[FIRSTLEFT][NOTSHOOTING] = area.tankleft; + goodImages[FIRSTLEFT+1][NOTSHOOTING] = area.tankleft2; + goodImages[FIRSTLEFT][SHOOTING] = area.tankleftshoot; + goodImages[FIRSTLEFT+1][SHOOTING] = area.tankleftshoot2; + + goodImages[FIRSTRIGHT][NOTSHOOTING] = area.tankright; + goodImages[FIRSTRIGHT+1][NOTSHOOTING] = area.tankright2; + goodImages[FIRSTRIGHT][SHOOTING] = area.tankrightshoot; + goodImages[FIRSTRIGHT+1][SHOOTING] = area.tankrightshoot2; + + badImages[FIRSTUP][NOTSHOOTING] = area.badtankup; + badImages[FIRSTUP+1][NOTSHOOTING] = area.badtankup2; + badImages[FIRSTUP][SHOOTING] = area.badtankupshoot; + badImages[FIRSTUP+1][SHOOTING] = area.badtankupshoot2; + + badImages[FIRSTDOWN][NOTSHOOTING] = area.badtankdown; + badImages[FIRSTDOWN+1][NOTSHOOTING] = area.badtankdown2; + badImages[FIRSTDOWN][SHOOTING] = area.badtankdownshoot; + badImages[FIRSTDOWN+1][SHOOTING] = area.badtankdownshoot2; + + badImages[FIRSTLEFT][NOTSHOOTING] = area.badtankleft; + badImages[FIRSTLEFT+1][NOTSHOOTING] = area.badtankleft2; + badImages[FIRSTLEFT][SHOOTING] = area.badtankleftshoot; + badImages[FIRSTLEFT+1][SHOOTING] = area.badtankleftshoot2; + + badImages[FIRSTRIGHT][NOTSHOOTING] = area.badtankright; + badImages[FIRSTRIGHT+1][NOTSHOOTING] = area.badtankright2; + badImages[FIRSTRIGHT][SHOOTING] = area.badtankrightshoot; + badImages[FIRSTRIGHT+1][SHOOTING] = area.badtankrightshoot2; + + enemies = new Thread(this); + enemies.start(); + } + + public void start() { + // called by Applet Viewer or Browser + doLevel(1); + } + + public void doLevel(int level) { + // this runs one 'level' + // create arrays of pits and enemies here. + // Maybe each level will have different numbers? + juststarted = true; + Point temppoint; + pitPositions = new Point[pitNumber]; + enemyPositions = new Point[enemyNumber]; + for (int i=0; i < enemyNumber; i++) enemyPositions[i] = new Point(0,0); + for (int i=0; i < pitNumber; i++) pitPositions[i] = new Point(0,0); + + enemyImageNo = new int[enemyNumber]; + enemyShooting = new boolean[enemyNumber]; + for (int i=0; i < enemyNumber; i++) { + enemyShooting[i] = false; + enemyImageNo[i] = FIRSTUP; // TODO - randomise + } + showStatus("Started level " + level + ": " + enemyNumber + " enemies and " + pitNumber + " pits"); + + // randomly position 1 player, x enemies and y pits + playerPosition = randomPosition(); + + for (int i = 0; i < enemyNumber; i++) { + temppoint = randomPosition(); + while (isPlayerPosition(temppoint) || + isTankPosition(temppoint)) { + // don't position any enemy on the player or on top of another enemy + temppoint = randomPosition(); + } + enemyPositions[i] = temppoint; + } + + for (int i = 0; i < pitNumber; i++) { + temppoint = randomPosition(); + while (isPlayerPosition(temppoint) || + isPitPosition(temppoint) || + isTankPosition(temppoint)) { + // don't position any enemy at the player, an enemy or another pit + temppoint = randomPosition(); + } + pitPositions[i] = temppoint; + } + + enemiesRemaining=enemyNumber; + // paint the panel here + area.repaint(); + ingame = true; + } + + synchronized void incrementImageNo() { + goodImageNo++; + if ((goodImageNo % 2) == 0) goodImageNo -= 2; + } + + synchronized void incrementImageNo(int enemyNo) { + enemyImageNo[enemyNo]++; + if ((enemyImageNo[enemyNo] % 2) == 0) enemyImageNo[enemyNo] -= 2; + } + + void goLeft(int enemyno) { + if (enemyImageNo[enemyno] == FIRSTLEFT || enemyImageNo[enemyno] == FIRSTLEFT+1) { + incrementImageNo(enemyno); + } + else + enemyImageNo[enemyno] = FIRSTLEFT; + } + + void goLeft() { + if (goodImageNo == FIRSTLEFT || goodImageNo == FIRSTLEFT+1) { + incrementImageNo(); + } + else + goodImageNo = FIRSTLEFT; + } + + void goRight(int enemyno) { + if (enemyImageNo[enemyno] == FIRSTRIGHT || enemyImageNo[enemyno] == FIRSTRIGHT+1) { + incrementImageNo(enemyno); + } + else + enemyImageNo[enemyno] = FIRSTRIGHT; + } + + void goRight() { + if (goodImageNo == FIRSTRIGHT || goodImageNo == FIRSTRIGHT+1) { + incrementImageNo(); + } + else + goodImageNo = FIRSTRIGHT; + } + + void goUp(int enemyno) { + if (enemyImageNo[enemyno] == FIRSTUP || enemyImageNo[enemyno] == FIRSTUP+1) { + incrementImageNo(enemyno); + } + else + enemyImageNo[enemyno] = FIRSTUP; + } + + void goUp() { + if (goodImageNo == FIRSTUP || goodImageNo == FIRSTUP+1) { + incrementImageNo(); + } + else + goodImageNo = FIRSTUP; + } + + void goDown(int enemyno) { + if (enemyImageNo[enemyno] == FIRSTDOWN || enemyImageNo[enemyno] == FIRSTDOWN+1) { + incrementImageNo(enemyno); + } + else + enemyImageNo[enemyno] = FIRSTDOWN; + } + + void goDown() { + if (goodImageNo == FIRSTDOWN || goodImageNo == FIRSTDOWN+1) { + incrementImageNo(); + } + else + goodImageNo = FIRSTDOWN; + } + + private Point randomPosition() { + return new Point( (int) (Math.random() * RIGHTEDGE) / XAMOUNT * XAMOUNT, + (int) (Math.random() * BOTTOMEDGE) / YAMOUNT * YAMOUNT); + } + + private boolean isPlayerPosition(Point p) { + return(p.x == playerPosition.x && p.y == playerPosition.y); + } + + private boolean isTankPosition(Point p) { + for (int i = 0 ; i < enemyNumber; i++) { + if(p.x == enemyPositions[i].x && p.y == enemyPositions[i].y) return(true); + } + return(false); + } + + private int isInline(Point p) { + // is the new position in the same row as the player? + if (Math.abs(p.x - playerPosition.x) < XAMOUNT) { + // see whether there is another enemy between this position and the player + if (playerPosition.y > p.y) { + for (int i = 0 ; i < enemyNumber; i++) { + if(p.x == enemyPositions[i].x && p.y < enemyPositions[i].y) return(X); + } + } + else { // playerPosition y < p.y + for (int i = 0 ; i < enemyNumber; i++) { + if(p.x == enemyPositions[i].x && p.y > enemyPositions[i].y) return(X); + } + } + } + else if (Math.abs(p.y - playerPosition.y) < YAMOUNT) { + // see whether there is another enemy between this position and the player + if (playerPosition.x > p.x) { + for (int i = 0 ; i < enemyNumber; i++) { + if(p.y == enemyPositions[i].y && p.x < enemyPositions[i].x) return(Y); + } + } + else { // playerPosition x < p.x + for (int i = 0 ; i < enemyNumber; i++) { + if(p.y == enemyPositions[i].y && p.x > enemyPositions[i].x) return(Y); + } + } + } + return(NOT); + } + + private boolean isPitPosition(Point p) { + for (int i = 0 ; i < pitNumber; i++) { + if(p.x == pitPositions[i].x && p.y == pitPositions[i].y) return(true); + } + return(false); + } + + public void finished() { + finished = true; + System.exit(0); + } + + public String getAppletInfo() { + return ("Tank Game"); + } + + private Point moveCloser(int enemyNo, Point original, Point target) { + Point result = new Point(original); + int inlineType = isInline(original); + // allowed to move EITHER X or Y but not both + if (Math.random() >= 0.5) { + // move in X direction + if (inlineType != X) { + if (original.x < target.x) { + result.x = original.x + (XAMOUNT/2); + goRight(enemyNo); + } + else if (original.x > target.x) { + result.x = original.x - (XAMOUNT/2); + goLeft(enemyNo); + } + } + } + else { + // move in Y direction + if (inlineType != Y) { + if (original.y < target.y) { + result.y = original.y + (YAMOUNT/2); + goDown(enemyNo); + } + else if (original.y > target.y) { + result.y = original.y - (YAMOUNT/2); + goUp(enemyNo); + } + } + } + /* + if (isTankPosition(result)) { + if (isTankPosition(new Point(result.x, original.y))) { + if (isTankPosition(new Point(original.x, result.y))) result = original; + else result = new Point(original.x, result.y); + } + else result = new Point(result.x, original.y); + } + */ + inlineType = isInline(result); + if (inlineType == X) { + // fire along the X axis + } + else if (inlineType == Y) { + // fire along the Y axis + } + return(result); + } + + private int randomMove() { + // return + or - value (randomly) + if (Math.random() >= 0.5) return(24); + else return(-24); + } + + + // this class will use just the key pressed event + public void keyPressed(KeyEvent e) { + if (ingame) { + if (! + ((e.getKeyCode() == KeyEvent.VK_DOWN && playerPosition.y >= (BOTTOMEDGE - YAMOUNT)) || + (e.getKeyCode() == KeyEvent.VK_UP && playerPosition.y <= (TOPEDGE + YAMOUNT)) || + (e.getKeyCode() == KeyEvent.VK_LEFT && playerPosition.x <= (LEFTEDGE + XAMOUNT)) || + (e.getKeyCode() == KeyEvent.VK_RIGHT && playerPosition.x >= (RIGHTEDGE - XAMOUNT)))) { + // valid move: move the player and then move the enemies + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + playerPosition.y += YAMOUNT; + goDown(); + } + else if (e.getKeyCode() == KeyEvent.VK_UP) { + playerPosition.y -= YAMOUNT; + goUp(); + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + playerPosition.x -= XAMOUNT; + goLeft(); + } + else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + playerPosition.x += XAMOUNT; + goRight(); + } + if (isTankPosition(playerPosition)) { + showStatus("The Player ran into an enemy!! Press the Enter key to restart the level"); + ingame = false; + } + if (isPitPosition(playerPosition)) { + showStatus("The Player ran into a pit!! Press the Enter key to restart the level"); + ingame = false; + } + area.repaint(); + } // if valid key press + } + else if (e.getKeyCode() == KeyEvent.VK_ENTER) { + doLevel(level++); + } + } + + public void run() { + while (true) { + if (juststarted) { + try {Thread.sleep(750);} + catch (Exception e) {} + juststarted = false; + } + try {Thread.sleep(DELAY);} + catch (InterruptedException e){} + if (ingame) { + // for each enemy, move the enemy closer to the player + for (int i=0; i < enemyPositions.length; i++) { + if (!deadTank(enemyPositions[i])) { + enemyPositions[i] = moveCloser(i, enemyPositions[i], playerPosition); + } + // if there is a pit at that position, fall into it and decrement count of enemies + // and set that enemy's position to -1, -1 + if (isPitPosition(enemyPositions[i])) { + showStatus("an enemy fell into a pit"); + explosionx=enemyPositions[i].x; + explosiony=enemyPositions[i].y; + + enemyPositions[i] = new Point(-1, -1); + enemiesRemaining--; + showStatus(enemyNumber-enemiesRemaining + " down, " + enemiesRemaining + " to go..."); + } + // if player is caught by an enemy or all enemies are gone, end the game + if (isPlayerPosition(enemyPositions[i])) { + showStatus("\"Mmm! Brains...\". The Player is dead. Press the Enter key to restart the level"); + level--; // because it will be incremented in a minute and we want to stay on the same 'level' + ingame = false; + } + } + if (enemiesRemaining == 0) { + showStatus("All the enemies are gone -- you won!! Press the Enter key to start the next level"); + enemyNumber++; + if (pitNumber > 2) pitNumber--; + ingame = false; + } + else area.repaint(); + } + } + } + + private boolean deadTank(Point p) { + return(p.x == -1 && p.y ==-1); + } + + public void keyReleased(KeyEvent e) { + } + + public void keyTyped(KeyEvent e) { + } +} + diff --git a/Tank/arenafloor.gif b/Tank/arenafloor.gif Binary files differ. diff --git a/Tank/bad-tank-down-2.gif b/Tank/bad-tank-down-2.gif Binary files differ. diff --git a/Tank/bad-tank-down-shoot-2.gif b/Tank/bad-tank-down-shoot-2.gif Binary files differ. diff --git a/Tank/bad-tank-down-shoot.gif b/Tank/bad-tank-down-shoot.gif Binary files differ. diff --git a/Tank/bad-tank-down.gif b/Tank/bad-tank-down.gif Binary files differ. diff --git a/Tank/bad-tank-left-2.gif b/Tank/bad-tank-left-2.gif Binary files differ. diff --git a/Tank/bad-tank-left-shoot-2.gif b/Tank/bad-tank-left-shoot-2.gif Binary files differ. diff --git a/Tank/bad-tank-left-shoot.gif b/Tank/bad-tank-left-shoot.gif Binary files differ. diff --git a/Tank/bad-tank-left.gif b/Tank/bad-tank-left.gif Binary files differ. diff --git a/Tank/bad-tank-right-2.gif b/Tank/bad-tank-right-2.gif Binary files differ. diff --git a/Tank/bad-tank-right-shoot-2.gif b/Tank/bad-tank-right-shoot-2.gif Binary files differ. diff --git a/Tank/bad-tank-right-shoot.gif b/Tank/bad-tank-right-shoot.gif Binary files differ. diff --git a/Tank/bad-tank-right.gif b/Tank/bad-tank-right.gif Binary files differ. diff --git a/Tank/bad-tank-up-2.gif b/Tank/bad-tank-up-2.gif Binary files differ. diff --git a/Tank/bad-tank-up-shoot-2.gif b/Tank/bad-tank-up-shoot-2.gif Binary files differ. diff --git a/Tank/bad-tank-up-shoot.gif b/Tank/bad-tank-up-shoot.gif Binary files differ. diff --git a/Tank/bad-tank-up.gif b/Tank/bad-tank-up.gif Binary files differ. diff --git a/Tank/files.txt b/Tank/files.txt @@ -0,0 +1,40 @@ + Volume in drive D has no label. + Volume Serial Number is 1450-9A5C + + Directory of D:\develop\Tank + +04/11/2003 17:11 850 arenafloor.gif +04/11/2003 17:02 1,266 bad-tank-down-2.gif +04/11/2003 17:05 1,271 bad-tank-down-shoot-2.gif +04/11/2003 17:07 1,260 bad-tank-down-shoot.gif +04/11/2003 16:59 1,255 bad-tank-down.gif +04/11/2003 17:03 1,225 bad-tank-left-2.gif +04/11/2003 17:05 1,230 bad-tank-left-shoot-2.gif +04/11/2003 17:07 1,221 bad-tank-left-shoot.gif +04/11/2003 16:59 1,217 bad-tank-left.gif +04/11/2003 17:01 1,225 bad-tank-right-2.gif +04/11/2003 17:04 1,226 bad-tank-right-shoot-2.gif +04/11/2003 17:07 1,214 bad-tank-right-shoot.gif +04/11/2003 16:58 1,212 bad-tank-right.gif +04/11/2003 17:01 1,265 bad-tank-up-2.gif +04/11/2003 17:04 1,270 bad-tank-up-shoot-2.gif +04/11/2003 17:06 1,266 bad-tank-up-shoot.gif +04/11/2003 16:57 1,264 bad-tank-up.gif +03/11/2003 18:26 1,266 tank-down-2.gif +03/11/2003 18:29 1,271 tank-down-shoot-2.gif +03/11/2003 18:21 1,260 tank-down-shoot.gif +03/11/2003 18:18 1,255 tank-down.gif +03/11/2003 18:26 1,225 tank-left-2.gif +03/11/2003 18:29 1,230 tank-left-shoot-2.gif +03/11/2003 18:21 1,221 tank-left-shoot.gif +03/11/2003 18:18 1,217 tank-left.gif +03/11/2003 18:26 1,225 tank-right-2.gif +03/11/2003 18:28 1,226 tank-right-shoot-2.gif +03/11/2003 18:21 1,214 tank-right-shoot.gif +03/11/2003 18:17 1,212 tank-right.gif +03/11/2003 18:25 1,265 tank-up-2.gif +03/11/2003 18:28 1,270 tank-up-shoot-2.gif +03/11/2003 18:20 1,266 tank-up-shoot.gif +03/11/2003 18:17 1,264 tank-up.gif + 33 File(s) 40,624 bytes + 0 Dir(s) 831,519,232 bytes free diff --git a/Tank/pit.gif b/Tank/pit.gif Binary files differ. diff --git a/Tank/tank-down-2.gif b/Tank/tank-down-2.gif Binary files differ. diff --git a/Tank/tank-down-shoot-2.gif b/Tank/tank-down-shoot-2.gif Binary files differ. diff --git a/Tank/tank-down-shoot.gif b/Tank/tank-down-shoot.gif Binary files differ. diff --git a/Tank/tank-down.gif b/Tank/tank-down.gif Binary files differ. diff --git a/Tank/tank-left-2.gif b/Tank/tank-left-2.gif Binary files differ. diff --git a/Tank/tank-left-shoot-2.gif b/Tank/tank-left-shoot-2.gif Binary files differ. diff --git a/Tank/tank-left-shoot.gif b/Tank/tank-left-shoot.gif Binary files differ. diff --git a/Tank/tank-left.gif b/Tank/tank-left.gif Binary files differ. diff --git a/Tank/tank-right-2.gif b/Tank/tank-right-2.gif Binary files differ. diff --git a/Tank/tank-right-shoot-2.gif b/Tank/tank-right-shoot-2.gif Binary files differ. diff --git a/Tank/tank-right-shoot.gif b/Tank/tank-right-shoot.gif Binary files differ. diff --git a/Tank/tank-right.gif b/Tank/tank-right.gif Binary files differ. diff --git a/Tank/tank-up-2.gif b/Tank/tank-up-2.gif Binary files differ. diff --git a/Tank/tank-up-shoot-2.gif b/Tank/tank-up-shoot-2.gif Binary files differ. diff --git a/Tank/tank-up-shoot.gif b/Tank/tank-up-shoot.gif Binary files differ. diff --git a/Tank/tank-up.gif b/Tank/tank-up.gif Binary files differ. diff --git a/Zombie/Zombie/Zombie/explosion1.gif b/Zombie/Zombie/Zombie/explosion1.gif Binary files differ. diff --git a/Zombie/Zombie/Zombie/explosion2.gif b/Zombie/Zombie/Zombie/explosion2.gif Binary files differ. diff --git a/Zombie/Zombie/Zombie/explosion3.gif b/Zombie/Zombie/Zombie/explosion3.gif Binary files differ. diff --git a/Zombie/Zombie/Zombie/person.gif b/Zombie/Zombie/Zombie/person.gif Binary files differ. diff --git a/Zombie/Zombie/Zombie/pit.gif b/Zombie/Zombie/Zombie/pit.gif Binary files differ. diff --git a/Zombie/Zombie/Zombie/zombie.gif b/Zombie/Zombie/Zombie/zombie.gif Binary files differ. diff --git a/Zombie/Zombie/Zombie/zombie.ico b/Zombie/Zombie/Zombie/zombie.ico Binary files differ. diff --git a/Zombie/Zombie/ZombieArea.java b/Zombie/Zombie/ZombieArea.java @@ -0,0 +1,62 @@ +package Zombie; + +import java.awt.*; + +public class ZombieArea extends Panel { + ZombieGame myApplet = null; + Image zombieImage; + Image personImage; + Image pitImage; + private Image explosion1, explosion2, explosion3; + + public ZombieArea(ZombieGame parent) { + myApplet = parent; + zombieImage = parent.getImage(myApplet.getCodeBase(), "Zombie\\" + "zombie.gif"); + personImage = parent.getImage(myApplet.getCodeBase(), "Zombie\\" + "person.gif"); + pitImage = parent.getImage(myApplet.getCodeBase(), "Zombie\\" + "pit.gif"); + explosion1 = parent.getImage(myApplet.getCodeBase(), "Zombie\\" + "explosion1.gif"); + explosion2 = parent.getImage(myApplet.getCodeBase(), "Zombie\\" + "explosion2.gif"); + explosion3 = parent.getImage(myApplet.getCodeBase(), "Zombie\\" + "explosion3.gif"); + } + + public void paint (Graphics g) { + if (myApplet == null) return; + final int w = getBounds().width; + final int h = getBounds().height; + g.setColor(Color.gray); + g.fillRect(0, 0, w, h); + FontMetrics fm = getFontMetrics(getFont()); + + g.setColor(Color.black); + int asc = fm.getAscent() + 4; + + if (myApplet.playerPosition != null) { + // show the player + //g.drawString("#", myApplet.playerPosition.x, myApplet.playerPosition.y); + g.drawImage(personImage, myApplet.playerPosition.x, myApplet.playerPosition.y,Color.gray, null); + + // show the pits + for (int i=0; i < myApplet.pitPositions.length; i++) { + g.drawImage(pitImage, myApplet.pitPositions[i].x, myApplet.pitPositions[i].y,Color.gray, null); + } + + // show the zombies + for (int i=0; i < myApplet.zombiePositions.length; i++) { + if (myApplet.zombiePositions[i].x > -1) + g.drawImage(zombieImage, myApplet.zombiePositions[i].x, myApplet.zombiePositions[i].y,null); + } + if (myApplet.explosionx != -1) { + g.drawImage(explosion1, myApplet.explosionx, myApplet.explosiony,Color.gray, null); + try { + Thread.sleep(80); + g.drawImage(explosion2, myApplet.explosionx, myApplet.explosiony,Color.gray, null); + Thread.sleep(80); + g.drawImage(explosion3, myApplet.explosionx, myApplet.explosiony,Color.gray, null); + } + catch (Exception e) {} + myApplet.explosionx = -1; + myApplet.explosiony=-1; + } + } + } +}+ \ No newline at end of file diff --git a/Zombie/Zombie/ZombieFrame.java b/Zombie/Zombie/ZombieFrame.java @@ -0,0 +1,10 @@ +package Zombie; + +import java.awt.Frame; + +public class ZombieFrame extends Frame { + + public ZombieFrame() { + setBounds(200, 200, 200, 150); + } +}+ \ No newline at end of file diff --git a/Zombie/Zombie/ZombieGame.java b/Zombie/Zombie/ZombieGame.java @@ -0,0 +1,299 @@ +/* Copyright (c) M Percival 2002 */ +/* Zombie game Created October 2002 */ + +package Zombie; + +import java.awt.*; +import java.awt.event.*; +import java.applet.*; + +public class ZombieGame extends Applet implements KeyListener, Runnable { + // all member variables 'static' because shared with the zombie action thread + private static ZombieArea area; + private static boolean finished = false; + private static boolean ingame = false; + private boolean juststarted = false; + private static int level = 1; + private static int zombiesRemaining; + protected static Point[] zombiePositions; + protected static Point playerPosition; + protected static Point[] pitPositions; + private Thread zombies; + + protected static int pitNumber = 15; + protected static int zombieNumber = 10; + protected static int RIGHTEDGE = 1200; + protected static final int LEFTEDGE = 0; + protected static final int TOPEDGE = 0; + protected static int BOTTOMEDGE = 1000; + protected static int XAMOUNT=5; + protected static int YAMOUNT=5; + private static final int X = 1; + private static final int Y = 2; + private static final int NOT=3; + private static final int DELAY = 125; + protected int explosionx =-1, explosiony=-1; + + public void init() { + + setLayout(null); + setBackground(Color.gray); + + area = new ZombieArea(this); + add(area); + FontMetrics fm = getFontMetrics(getFont()); + RIGHTEDGE = getBounds().width - 1; + BOTTOMEDGE = getBounds().height - 1; + XAMOUNT = 12; + YAMOUNT = 12; + setVisible(true); + area.setBounds(0,0,RIGHTEDGE,BOTTOMEDGE); + area.setVisible(true); + + addKeyListener(this); + area.addKeyListener(this); + area.requestFocus(); + + zombies = new Thread(this); + zombies.start(); + } + + public void start() { + // called by Applet Viewer or Browser + doLevel(1); + } + + public void doLevel(int level) { + // this runs one 'level' + // create arrays of pits and zombies here. + // Maybe each level will have different numbers? + juststarted = true; + Point temppoint; + pitPositions = new Point[pitNumber]; + zombiePositions = new Point[zombieNumber]; + for (int i=0; i < zombieNumber; i++) zombiePositions[i] = new Point(0,0); + for (int i=0; i < pitNumber; i++) pitPositions[i] = new Point(0,0); + + showStatus("Started level " + level + ": " + zombieNumber + " zombies and " + pitNumber + " pits"); + + // randomly position 1 player, x zombies and y pits + playerPosition = randomPosition(); + + for (int i = 0; i < zombieNumber; i++) { + temppoint = randomPosition(); + while (isPlayerPosition(temppoint) || + isZombiePosition(temppoint)) { + // don't position any zombie on the player or on top of another zombie + temppoint = randomPosition(); + } + zombiePositions[i] = temppoint; + } + + for (int i = 0; i < pitNumber; i++) { + temppoint = randomPosition(); + while (isPlayerPosition(temppoint) || + isPitPosition(temppoint) || + isZombiePosition(temppoint)) { + // don't position any zombie at the player, a zombie or another pit + temppoint = randomPosition(); + } + pitPositions[i] = temppoint; + } + + zombiesRemaining=zombieNumber; + // paint the panel here + area.repaint(); + ingame = true; + } + + private Point randomPosition() { + return new Point( (int) (Math.random() * RIGHTEDGE) / XAMOUNT * XAMOUNT, + (int) (Math.random() * BOTTOMEDGE) / YAMOUNT * YAMOUNT); + } + + private boolean isPlayerPosition(Point p) { + return(p.x == playerPosition.x && p.y == playerPosition.y); + } + + private boolean isZombiePosition(Point p) { + for (int i = 0 ; i < zombieNumber; i++) { + if(p.x == zombiePositions[i].x && p.y == zombiePositions[i].y) return(true); + } + return(false); + } + + private int isInline(Point p) { + // is the new position in the same row as the player? + if (Math.abs(p.x - playerPosition.x) < XAMOUNT) { + // see whether there is another zombie between this position and the player + if (playerPosition.y > p.y) { + for (int i = 0 ; i < zombieNumber; i++) { + if(p.x == zombiePositions[i].x && p.y < zombiePositions[i].y) return(X); + } + } + else { // playerPosition y < p.y + for (int i = 0 ; i < zombieNumber; i++) { + if(p.x == zombiePositions[i].x && p.y > zombiePositions[i].y) return(X); + } + } + } + else if (Math.abs(p.y - playerPosition.y) < YAMOUNT) { + // see whether there is another zombie between this position and the player + if (playerPosition.x > p.x) { + for (int i = 0 ; i < zombieNumber; i++) { + if(p.y == zombiePositions[i].y && p.x < zombiePositions[i].x) return(Y); + } + } + else { // playerPosition x < p.x + for (int i = 0 ; i < zombieNumber; i++) { + if(p.y == zombiePositions[i].y && p.x > zombiePositions[i].x) return(Y); + } + } + } + return(NOT); + } + + private boolean isPitPosition(Point p) { + for (int i = 0 ; i < pitNumber; i++) { + if(p.x == pitPositions[i].x && p.y == pitPositions[i].y) return(true); + } + return(false); + } + + public void finished() { + finished = true; + System.exit(0); + } + + public String getAppletInfo() { + return ("Zombie Game"); + } + + private Point moveCloser(Point original, Point target) { + Point result = new Point(original); + int inlineType = isInline(original); + if (inlineType != X) { + if (original.x < target.x) result.x = original.x + (XAMOUNT/2); + else if (original.x > target.x) result.x = original.x - (XAMOUNT/2); + } + else { + // move out of the Y alignment - randomly left or right + result.x += randomMove(); + } + if (inlineType != Y) { + if (original.y < target.y) result.y = original.y + (YAMOUNT/2); + else if (original.y > target.y) result.y = original.y - (YAMOUNT/2); + } + else { + // move out of the Y alignment - randomly up or down + result.y += randomMove(); + } + if (isZombiePosition(result)) { + if (isZombiePosition(new Point(result.x, original.y))) { + if (isZombiePosition(new Point(original.x, result.y))) result = original; + else result = new Point(original.x, result.y); + } + else result = new Point(result.x, original.y); + } + return(result); + } + + private int randomMove() { + // return + or - value (randomly) + if (Math.random() >= 0.5) return(24); + else return(-24); + } + + + // this class will use just the key pressed event + public void keyPressed(KeyEvent e) { + if (ingame) { + if (! + ((e.getKeyCode() == KeyEvent.VK_DOWN && playerPosition.y >= (BOTTOMEDGE - YAMOUNT)) || + (e.getKeyCode() == KeyEvent.VK_UP && playerPosition.y <= (TOPEDGE + YAMOUNT)) || + (e.getKeyCode() == KeyEvent.VK_LEFT && playerPosition.x <= (LEFTEDGE + XAMOUNT)) || + (e.getKeyCode() == KeyEvent.VK_RIGHT && playerPosition.x >= (RIGHTEDGE - XAMOUNT)))) { + // valid move: move the player and then move the zombies + if (e.getKeyCode() == KeyEvent.VK_DOWN) { + playerPosition.y += YAMOUNT; + } + else if (e.getKeyCode() == KeyEvent.VK_UP) { + playerPosition.y -= YAMOUNT; + } + else if (e.getKeyCode() == KeyEvent.VK_LEFT) { + playerPosition.x -= XAMOUNT; + } + else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { + playerPosition.x += XAMOUNT; + } + if (isZombiePosition(playerPosition)) { + showStatus("The Player ran into a zombie!! Press the Enter key to restart the level"); + ingame = false; + } + if (isPitPosition(playerPosition)) { + showStatus("The Player ran into a pit!! Press the Enter key to restart the level"); + ingame = false; + } + area.repaint(); + } // if valid key press + } + else if (e.getKeyCode() == KeyEvent.VK_ENTER) { + doLevel(level++); + } + } + + public void run() { + while (true) { + if (juststarted) { + try {Thread.sleep(750);} + catch (Exception e) {} + juststarted = false; + } + try {Thread.sleep(DELAY);} + catch (InterruptedException e){} + if (ingame) { + // for each zombie, move the zombie closer to the player + for (int i=0; i < zombiePositions.length; i++) { + if (!deadZombie(zombiePositions[i])) { + zombiePositions[i] = moveCloser(zombiePositions[i], playerPosition); + } + // if there is a pit at that position, fall into it and decrement count of zombies + // and set that zombie's position to -1, -1 + if (isPitPosition(zombiePositions[i])) { + showStatus("A zombie fell into a pit"); + explosionx=zombiePositions[i].x; + explosiony=zombiePositions[i].y; + + zombiePositions[i] = new Point(-1, -1); + zombiesRemaining--; + showStatus(zombieNumber-zombiesRemaining + " down, " + zombiesRemaining + " to go..."); + } + // if player is caught by a zombie or all zombies are gone, end the game + if (isPlayerPosition(zombiePositions[i])) { + showStatus("\"Mmm! Brains...\". The Player is dead. Press the Enter key to restart the level"); + level--; // because it will be incremented in a minute and we want to stay on the same 'level' + ingame = false; + } + } + if (zombiesRemaining == 0) { + showStatus("All the zombies are gone -- you won!! Press the Enter key to start the next level"); + zombieNumber++; + if (pitNumber > 2) pitNumber--; + ingame = false; + } + else area.repaint(); + } + } + } + + private boolean deadZombie(Point p) { + return(p.x == -1 && p.y ==-1); + } + + public void keyReleased(KeyEvent e) { + } + + public void keyTyped(KeyEvent e) { + } +} + diff --git a/Zombie/Zombie/explosion1.gif b/Zombie/Zombie/explosion1.gif Binary files differ. diff --git a/Zombie/Zombie/explosion2.gif b/Zombie/Zombie/explosion2.gif Binary files differ. diff --git a/Zombie/Zombie/explosion3.gif b/Zombie/Zombie/explosion3.gif Binary files differ. diff --git a/Zombie/Zombie/java.policy.applet b/Zombie/Zombie/java.policy.applet @@ -0,0 +1,7 @@ +/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/ +/* DO NOT EDIT */ + +grant { + permission java.security.AllPermission; +}; + diff --git a/Zombie/Zombie/person.gif b/Zombie/Zombie/person.gif Binary files differ. diff --git a/Zombie/Zombie/pit.gif b/Zombie/Zombie/pit.gif Binary files differ. diff --git a/Zombie/Zombie/zombie.gif b/Zombie/Zombie/zombie.gif Binary files differ. diff --git a/Zombie/Zombie/zombie.ico b/Zombie/Zombie/zombie.ico Binary files differ. diff --git a/Zombie/java.policy.applet b/Zombie/java.policy.applet @@ -0,0 +1,7 @@ +/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/ +/* DO NOT EDIT */ + +grant { + permission java.security.AllPermission; +}; + diff --git a/Zombies.html b/Zombies.html @@ -0,0 +1,8 @@ +<HTML> +<HEAD> +<TITLE>Zombie Game</TITLE> +</HEAD> +<BODY> +<APPLET CODE="Zombie.ZombieGame.class" WIDTH=800 HEIGHT=600 X=200 Y=0></APPLET> +</BODY> +</HTML> diff --git a/autogen_Reaper.html b/autogen_Reaper.html @@ -0,0 +1,8 @@ +<HTML> +<HEAD> +<TITLE>Autogenerated HTML</TITLE> +</HEAD> +<BODY> +<APPLET CODE="Reaper.ReaperGame.class" WIDTH=430 HEIGHT=270></APPLET> +</BODY> +</HTML> diff --git a/autogen_asteroids.html b/autogen_asteroids.html @@ -0,0 +1,8 @@ +<HTML> +<HEAD> +<TITLE>Autogenerated HTML</TITLE> +</HEAD> +<BODY> +<APPLET CODE="Asteroids.class" WIDTH=430 HEIGHT=270></APPLET> +</BODY> +</HTML> diff --git a/java.policy.applet b/java.policy.applet @@ -0,0 +1,7 @@ +/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/ +/* DO NOT EDIT */ + +grant { + permission java.security.AllPermission; +}; +