diff --git a/LoveRocket3-copy-2/Airplain.class b/LoveRocket3-copy-2/Airplain.class new file mode 100644 index 0000000000000000000000000000000000000000..1733aee7de8c8611b8cdd556c5e79fed561bbc2e Binary files /dev/null and b/LoveRocket3-copy-2/Airplain.class differ diff --git a/LoveRocket3-copy-2/Airplain.ctxt b/LoveRocket3-copy-2/Airplain.ctxt new file mode 100644 index 0000000000000000000000000000000000000000..d970724ec53401052811c6d555970cbc2507d3a8 --- /dev/null +++ b/LoveRocket3-copy-2/Airplain.ctxt @@ -0,0 +1,7 @@ +#BlueJ class context +comment0.target=Airplain +comment0.text=\n\ Write\ a\ description\ of\ class\ Airplain\ here.\n\ \n\ @author\ (your\ name)\ \n\ @version\ (a\ version\ number\ or\ a\ date)\n +comment1.params= +comment1.target=void\ act() +comment1.text=\n\ Act\ -\ do\ whatever\ the\ Airplain\ wants\ to\ do.\ This\ method\ is\ called\ whenever\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\n +numComments=2 diff --git a/LoveRocket3-copy-2/Airplain.java b/LoveRocket3-copy-2/Airplain.java new file mode 100644 index 0000000000000000000000000000000000000000..e65f511ac16fca12cf4e9c988ec126bd28b621a0 --- /dev/null +++ b/LoveRocket3-copy-2/Airplain.java @@ -0,0 +1,25 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) + +/** + * Write a description of class Airplain here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class Airplain extends Actor +{ + /** + * Act - do whatever the Airplain wants to do. This method is called whenever + * the 'Act' or 'Run' button gets pressed in the environment. + */ + public void act() + { + move(5); + setLocation(getX(), getY() -2); + + if(this.getX() <= 10 || this.getX() >= 690 ) + { + turn(180); + }// Add your action code here. + } +} diff --git a/LoveRocket3-copy-2/Ballon.class b/LoveRocket3-copy-2/Ballon.class new file mode 100644 index 0000000000000000000000000000000000000000..9830cdb1434285fb5ced5f8ff3d1336cf6c30f4a Binary files /dev/null and b/LoveRocket3-copy-2/Ballon.class differ diff --git a/LoveRocket3-copy-2/Ballon.ctxt b/LoveRocket3-copy-2/Ballon.ctxt new file mode 100644 index 0000000000000000000000000000000000000000..70f1e075c199f3b76a7ee90feb4abc2b5d4b00c4 --- /dev/null +++ b/LoveRocket3-copy-2/Ballon.ctxt @@ -0,0 +1,7 @@ +#BlueJ class context +comment0.target=Ballon +comment0.text=\n\ Write\ a\ description\ of\ class\ Ballon\ here.\n\ \n\ @author\ (your\ name)\ \n\ @version\ (a\ version\ number\ or\ a\ date)\n +comment1.params= +comment1.target=void\ act() +comment1.text=\n\ Act\ -\ do\ whatever\ the\ Ballon\ wants\ to\ do.\ This\ method\ is\ called\ whenever\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\n +numComments=2 diff --git a/LoveRocket3-copy-2/Ballon.java b/LoveRocket3-copy-2/Ballon.java new file mode 100644 index 0000000000000000000000000000000000000000..1f9418b93a59f2b5f1001a95508f126c6ec8efe2 --- /dev/null +++ b/LoveRocket3-copy-2/Ballon.java @@ -0,0 +1,21 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) + +/** + * Write a description of class Ballon here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class Ballon extends Actor +{ + /** + * Act - do whatever the Ballon wants to do. This method is called whenever + * the 'Act' or 'Run' button gets pressed in the environment. + */ + public void act() + { + + setLocation(getX() + Greenfoot.getRandomNumber(10) - 3, getY() - Greenfoot.getRandomNumber(5)); + // Add your action code here. + } +} diff --git a/LoveRocket3-copy-2/Coins.class b/LoveRocket3-copy-2/Coins.class new file mode 100644 index 0000000000000000000000000000000000000000..6ec3505cc0c40ab163ad41d048e7f01d1f66bf3a Binary files /dev/null and b/LoveRocket3-copy-2/Coins.class differ diff --git a/LoveRocket3-copy-2/Coins.ctxt b/LoveRocket3-copy-2/Coins.ctxt new file mode 100644 index 0000000000000000000000000000000000000000..52c836d816b83bdaafc856ec83ca72d7ed7e074e --- /dev/null +++ b/LoveRocket3-copy-2/Coins.ctxt @@ -0,0 +1,7 @@ +#BlueJ class context +comment0.target=Coins +comment0.text=\n\ Write\ a\ description\ of\ class\ Coins\ here.\n\ \n\ @author\ (your\ name)\ \n\ @version\ (a\ version\ number\ or\ a\ date)\n +comment1.params= +comment1.target=void\ act() +comment1.text=\n\ Act\ -\ do\ whatever\ the\ Coins\ wants\ to\ do.\ This\ method\ is\ called\ whenever\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\n +numComments=2 diff --git a/LoveRocket3-copy-2/Coins.java b/LoveRocket3-copy-2/Coins.java new file mode 100644 index 0000000000000000000000000000000000000000..43ae0f3c837c1a20ae3a3d5920c1e87369ec4292 --- /dev/null +++ b/LoveRocket3-copy-2/Coins.java @@ -0,0 +1,19 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) + +/** + * Write a description of class Coins here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class Coins extends Actor +{ + /** + * Act - do whatever the Coins wants to do. This method is called whenever + * the 'Act' or 'Run' button gets pressed in the environment. + */ + public void act() + { + // Add your action code here. + } +} diff --git a/LoveRocket3-copy-2/LoveRocket.class b/LoveRocket3-copy-2/LoveRocket.class new file mode 100644 index 0000000000000000000000000000000000000000..ab1dac8d3cbf4196fb0514714f272465ce8c7e21 Binary files /dev/null and b/LoveRocket3-copy-2/LoveRocket.class differ diff --git a/LoveRocket3-copy-2/LoveRocket.ctxt b/LoveRocket3-copy-2/LoveRocket.ctxt new file mode 100644 index 0000000000000000000000000000000000000000..99b62a91eb6d4d38d14c3609bf14665a7334fda0 --- /dev/null +++ b/LoveRocket3-copy-2/LoveRocket.ctxt @@ -0,0 +1,15 @@ +#BlueJ class context +comment0.target=LoveRocket +comment0.text=\n\ Write\ a\ description\ of\ class\ LoveRocket\ here.\n\ \n\ @author\ (your\ name)\ \n\ @version\ (a\ version\ number\ or\ a\ date)\n +comment1.params= +comment1.target=void\ act() +comment2.params= +comment2.target=void\ checkKeys() +comment3.params= +comment3.target=void\ kollision() +comment4.params= +comment4.target=void\ leben() +comment4.text=Die\ Leben\ des\ Spielers\ werden\ als\ Text\ angezeigt. +comment5.params= +comment5.target=void\ touchcoins() +numComments=6 diff --git a/LoveRocket3-copy-2/LoveRocket.java b/LoveRocket3-copy-2/LoveRocket.java new file mode 100644 index 0000000000000000000000000000000000000000..114bddbc265cefe5130bcc09a5be9ffc4cf9e3af --- /dev/null +++ b/LoveRocket3-copy-2/LoveRocket.java @@ -0,0 +1,111 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) + +/** + * Write a description of class LoveRocket here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class LoveRocket extends Actor +{/** + * Act - do whatever the LoveRocket wants to do. This method is called whenever + * the 'Act' or 'Run' button gets pressed in the environment. + */ + + int leben = 3; + public void act() + { + // Add your action code here. + checkKeys(); + this.kollision(); + this.leben(); + touchcoins(); + + } + + public void checkKeys() + + { + SpaceWorld meineWelt; + meineWelt = (SpaceWorld)this.getWorld(); + meineWelt.changeBackgroundY(-3); + if (this.getY() < 650) + { + setLocation(getX(), getY() + 1); + } + if(Greenfoot.isKeyDown("d")) + { + if (this.getX() < 700) + { + setLocation(getX() + 5, getY()); + } + } + if(Greenfoot.isKeyDown("a")) + { + if (this.getX() > 0) + { + setLocation(getX() - 5, getY()); + } + } + if(Greenfoot.isKeyDown("w")) + { + this.setImage("rocketFire.png"); + + if (this.getY() > 0) + { + setLocation(getX(), getY() - 5); + } + } + if(Greenfoot.isKeyDown("s")) + { + if (this.getY() < 720) + { + setLocation(getX(), getY() + 2); + } + + } + + } + public void kollision() { + /* Das vom Spieler getroffene Objekt wird im Actor zwischengespeichert.*/ + Actor airplain = this.getOneIntersectingObject(Airplain.class); + Actor ballon = this.getOneIntersectingObject(Ballon.class); + /* Das in Actor gespeicherte Object wird entfernt.*/ + if(isTouching(Airplain.class)) { + getWorld().removeObject(airplain); + leben--; + } + if(isTouching(Ballon.class)) { + getWorld().removeObject(ballon); + leben--; + } + } + /* Die Leben des Spielers werden als Text angezeigt.*/ + public void leben() { + if(leben == 3) { + this.getWorld().showText("Leben = 3", 100, 20); + } + if(leben == 2) { + this.getWorld().showText("Leben = 2", 100, 20); + } + if(leben == 1) { + this.getWorld().showText("Leben = 1", 100, 20); + } + if (leben == 0) { + this.getWorld().showText("Leben = 0", 100, 20); + this.getWorld().showText("Game Over", 300, 200); + Greenfoot.stop(); + } + } + //methode die abprüft ob der spieler food berührt + public void touchcoins() + { + //checkt ob player Coins anfässt, wenn er es tut wird + //food removed + if (isTouching(Coins.class) == true) + { + removeTouching(Coins.class); + Scoreboard.score++; + } + } +} diff --git a/LoveRocket3-copy-2/README.TXT b/LoveRocket3-copy-2/README.TXT new file mode 100644 index 0000000000000000000000000000000000000000..7342ea587de920c95ba48e03f9bd8706009a1e5b --- /dev/null +++ b/LoveRocket3-copy-2/README.TXT @@ -0,0 +1,12 @@ +------------------------------------------------------------------------ +This is the project README file. Here, you should describe your project. +Tell the reader (someone who does not know anything about this project) +all they need to know. The comments should usually include at least: +------------------------------------------------------------------------ + +PROJECT TITLE: +PURPOSE OF PROJECT: +VERSION or DATE: +HOW TO START THIS PROJECT: +AUTHORS: +USER INSTRUCTIONS: diff --git a/LoveRocket3-copy-2/Scoreboard.class b/LoveRocket3-copy-2/Scoreboard.class new file mode 100644 index 0000000000000000000000000000000000000000..0ee4b422c01223502d8ec8758f64b6533d2ba827 Binary files /dev/null and b/LoveRocket3-copy-2/Scoreboard.class differ diff --git a/LoveRocket3-copy-2/Scoreboard.ctxt b/LoveRocket3-copy-2/Scoreboard.ctxt new file mode 100644 index 0000000000000000000000000000000000000000..f679ef757541a98055cd8fd230a311dbd428e6d6 --- /dev/null +++ b/LoveRocket3-copy-2/Scoreboard.ctxt @@ -0,0 +1,6 @@ +#BlueJ class context +comment0.target=Scoreboard +comment0.text=\n\ Write\ a\ description\ of\ class\ Scoreboard\ here.\n\ \n\ @author\ (your\ name)\ \n\ @version\ (a\ version\ number\ or\ a\ date)\n +comment1.params= +comment1.target=void\ act() +numComments=2 diff --git a/LoveRocket3-copy-2/Scoreboard.java b/LoveRocket3-copy-2/Scoreboard.java new file mode 100644 index 0000000000000000000000000000000000000000..db62bc28c4380d488169f3a5eb6ea3b9ea77000a --- /dev/null +++ b/LoveRocket3-copy-2/Scoreboard.java @@ -0,0 +1,25 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) + +/** + * Write a description of class Scoreboard here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class Scoreboard extends Actor +{ + /** + * Act - do whatever the Scoreboard wants to do. This method is called whenever + * the 'Act' or 'Run' button gets pressed in the environment. + */ + public static int score = 0; + public void act() + { + //größe des bildes wird eingestellt + GreenfootImage image = getImage(); + image.scale(100,100); + + //scoreboard text wird geoutputtet + this.getWorld().showText("Score: " + score, 77, 650);// Add your action code here. + } +} diff --git a/LoveRocket3-copy-2/SpaceWorld.class b/LoveRocket3-copy-2/SpaceWorld.class new file mode 100644 index 0000000000000000000000000000000000000000..9d4b7ab951a8e4bf379d9dc5e5588a2db5c66cb6 Binary files /dev/null and b/LoveRocket3-copy-2/SpaceWorld.class differ diff --git a/LoveRocket3-copy-2/SpaceWorld.ctxt b/LoveRocket3-copy-2/SpaceWorld.ctxt new file mode 100644 index 0000000000000000000000000000000000000000..c3ac5ce452929f072bea10d9bda9588d5389a07f --- /dev/null +++ b/LoveRocket3-copy-2/SpaceWorld.ctxt @@ -0,0 +1,16 @@ +#BlueJ class context +comment0.target=SpaceWorld +comment0.text=\n\ Write\ a\ description\ of\ class\ SpaceWorld\ here.\n\ \n\ @author\ (your\ name)\ \n\ @version\ (a\ version\ number\ or\ a\ date)\n +comment1.params= +comment1.target=SpaceWorld() +comment2.params= +comment2.target=void\ act() +comment3.params= +comment3.target=void\ fillWorld() +comment4.params=changeY +comment4.target=void\ changeBackgroundY(int) +comment5.params= +comment5.target=void\ drawBackground() +comment6.params= +comment6.target=java.util.List\ showAllActors() +numComments=7 diff --git a/LoveRocket3-copy-2/SpaceWorld.java b/LoveRocket3-copy-2/SpaceWorld.java new file mode 100644 index 0000000000000000000000000000000000000000..17735a2867a5e4c15a47169d0de665cd85b6e41a --- /dev/null +++ b/LoveRocket3-copy-2/SpaceWorld.java @@ -0,0 +1,111 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) +import java.util.*; + +/** + * Write a description of class SpaceWorld here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class SpaceWorld extends World +{ + + /** + * Constructor for objects of class SpaceWorld. + * + */ + GreenfootImage hintergrund; // Variable Hintergrundbild + private int hintergrundY = - 5000; // y-Koordinate des Hintergrund + + public SpaceWorld() + { + // Create a new world with 600x400 cells with a cell size of 1x1 pixels. + super(700, 700, 1, false); /* Größe der Welt, false=Möglichkeit Objekte + ausserhalb des Sichtbereiches zu platzieren + */ + hintergrund = new GreenfootImage("background.jpg"); // Fuellt die background Variable + this.getBackground().drawImage(hintergrund, 0 , -5000);/* gibt leeren Hintergrund + wieder und zeichnet das Bild der Variablen hintergrund an die Position 0, -1000 + */ + this.fillWorld(); // Fügt Objekte in die Welt ein + } + + public void act() + { + this.drawBackground(); + } + + public void fillWorld() { + Scoreboard.score = 0; + Scoreboard scoreboard = new Scoreboard(); + this.addObject(scoreboard, 70, 650); + + LoveRocket myLoveRocket; + myLoveRocket = new LoveRocket(); + this.addObject(myLoveRocket, this.getWidth() / 2, 650); + myLoveRocket.turn(270); + + Airplain myAirplain01; + myAirplain01 = new Airplain(); + this.addObject(myAirplain01, 50, 180); + + Airplain myAirplain02; + myAirplain02 = new Airplain(); + this.addObject(myAirplain02, 250, 300); + + Ballon myBallon01; + myBallon01 = new Ballon(); + this.addObject(myBallon01, 500, 100); + Ballon myBallon02; + myBallon02 = new Ballon(); + this.addObject(myBallon02, 200, 200); + Ballon myBallon03; + myBallon03 = new Ballon(); + this.addObject(myBallon03, 100, 100); + Ballon myBallon04; + myBallon04 = new Ballon(); + this.addObject(myBallon04, 700, 50); + Ballon myBallon05; + myBallon05 = new Ballon(); + this.addObject(myBallon05, 50, 400); + Ballon myBallon06; + myBallon06 = new Ballon(); + this.addObject(myBallon06, 600, 300); + Ballon myBallon07; + myBallon07 = new Ballon(); + this.addObject(myBallon07, 280, 10); + Ballon myBallon08; + myBallon08 = new Ballon(); + this.addObject(myBallon08, 800, 0); + + } + + public void changeBackgroundY(int changeY) + { + hintergrundY = hintergrundY -changeY; + + for(int zaehler = 0; zaehler < this.showAllActors().size();zaehler++) + { + if(this.showAllActors().get(zaehler).getClass() != LoveRocket.class && this.showAllActors().get(zaehler).getClass() != Scoreboard.class) + { + this.showAllActors().get(zaehler).setLocation( + this.showAllActors().get(zaehler).getX(), + this.showAllActors().get(zaehler).getY() - changeY); + } + } + } + + public void drawBackground() + { + this.getBackground().drawImage(hintergrund, 0, hintergrundY); + + } + + public List<Actor> showAllActors() + { + List<Actor> allActors; + allActors = this.getObjects(Actor.class); + return allActors; + } +} + diff --git a/LoveRocket3-copy-2/airplane.png b/LoveRocket3-copy-2/airplane.png new file mode 100644 index 0000000000000000000000000000000000000000..b10a7e4669f2dafe2faa9eaf6b61a091296c9d0e Binary files /dev/null and b/LoveRocket3-copy-2/airplane.png differ diff --git a/LoveRocket3-copy-2/images/Wall.jpg b/LoveRocket3-copy-2/images/Wall.jpg new file mode 100644 index 0000000000000000000000000000000000000000..66e434434d8425346987e00a6ac7d7da4703a567 Binary files /dev/null and b/LoveRocket3-copy-2/images/Wall.jpg differ diff --git a/LoveRocket3-copy-2/images/airplane.png b/LoveRocket3-copy-2/images/airplane.png new file mode 100644 index 0000000000000000000000000000000000000000..2ddca1e616b603b3e3fa1c7b670bbe6427b93411 Binary files /dev/null and b/LoveRocket3-copy-2/images/airplane.png differ diff --git a/LoveRocket3-copy-2/images/background.jpg b/LoveRocket3-copy-2/images/background.jpg new file mode 100644 index 0000000000000000000000000000000000000000..58230cd5d76bbe2c59890d3f7428c6d6277ea10d Binary files /dev/null and b/LoveRocket3-copy-2/images/background.jpg differ diff --git a/LoveRocket3-copy-2/images/background2.jpg b/LoveRocket3-copy-2/images/background2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ee4d4c5c0d7f2c956ad2d90208ab1ae45a1914a4 Binary files /dev/null and b/LoveRocket3-copy-2/images/background2.jpg differ diff --git a/LoveRocket3-copy-2/images/balloon3.png b/LoveRocket3-copy-2/images/balloon3.png new file mode 100644 index 0000000000000000000000000000000000000000..1123af43a5018e23854a9eaa6594ce819faaed42 Binary files /dev/null and b/LoveRocket3-copy-2/images/balloon3.png differ diff --git a/LoveRocket3-copy-2/images/mushroom.png b/LoveRocket3-copy-2/images/mushroom.png new file mode 100644 index 0000000000000000000000000000000000000000..243d613de23d3e94255c7c408683f5146013ac54 Binary files /dev/null and b/LoveRocket3-copy-2/images/mushroom.png differ diff --git a/LoveRocket3-copy-2/images/rocket.png b/LoveRocket3-copy-2/images/rocket.png new file mode 100644 index 0000000000000000000000000000000000000000..16cce7bef653be7ee42fec7eaa77023249d20401 Binary files /dev/null and b/LoveRocket3-copy-2/images/rocket.png differ diff --git a/LoveRocket3-copy-2/images/rocketFire.png b/LoveRocket3-copy-2/images/rocketFire.png new file mode 100644 index 0000000000000000000000000000000000000000..d54823e18b3f5d27238ebb214a9af674944a655c Binary files /dev/null and b/LoveRocket3-copy-2/images/rocketFire.png differ diff --git a/LoveRocket3-copy-2/project.greenfoot b/LoveRocket3-copy-2/project.greenfoot new file mode 100644 index 0000000000000000000000000000000000000000..689c3b2ec8af4b0124d42f33be3d3e002ad06446 --- /dev/null +++ b/LoveRocket3-copy-2/project.greenfoot @@ -0,0 +1,101 @@ +#Greenfoot project file +class.Airplain.image=airplane.png +class.Ballon.image=balloon3.png +class.Coins.image=mushroom.png +class.LoveRocket.image=rocket.png +class.Scoreboard.image=Wall.jpg +dependency1.from=SpaceWorld +dependency1.to=Scoreboard +dependency1.type=UsesDependency +dependency2.from=SpaceWorld +dependency2.to=LoveRocket +dependency2.type=UsesDependency +dependency3.from=SpaceWorld +dependency3.to=Airplain +dependency3.type=UsesDependency +dependency4.from=SpaceWorld +dependency4.to=Ballon +dependency4.type=UsesDependency +dependency5.from=LoveRocket +dependency5.to=SpaceWorld +dependency5.type=UsesDependency +dependency6.from=LoveRocket +dependency6.to=Airplain +dependency6.type=UsesDependency +dependency7.from=LoveRocket +dependency7.to=Ballon +dependency7.type=UsesDependency +dependency8.from=LoveRocket +dependency8.to=Coins +dependency8.type=UsesDependency +dependency9.from=LoveRocket +dependency9.to=Scoreboard +dependency9.type=UsesDependency +editor.fx.0.height=0 +editor.fx.0.width=0 +editor.fx.0.x=0 +editor.fx.0.y=0 +height=873 +package.numDependencies=9 +package.numTargets=6 +project.charset=UTF-8 +publish.hasSource=false +publish.locked=true +publish.longDesc= +publish.shortDesc= +publish.tags= +publish.title= +publish.url= +readme.height=60 +readme.name=@README +readme.width=48 +readme.x=10 +readme.y=10 +simulation.speed=49 +target1.height=70 +target1.name=Airplain +target1.showInterface=false +target1.type=ClassTarget +target1.width=120 +target1.x=0 +target1.y=0 +target2.height=70 +target2.name=Scoreboard +target2.showInterface=false +target2.type=ClassTarget +target2.width=120 +target2.x=0 +target2.y=0 +target3.height=70 +target3.name=Coins +target3.showInterface=false +target3.type=ClassTarget +target3.width=120 +target3.x=0 +target3.y=0 +target4.height=70 +target4.name=LoveRocket +target4.showInterface=false +target4.type=ClassTarget +target4.width=120 +target4.x=0 +target4.y=0 +target5.height=70 +target5.name=Ballon +target5.showInterface=false +target5.type=ClassTarget +target5.width=120 +target5.x=0 +target5.y=0 +target6.height=70 +target6.name=SpaceWorld +target6.showInterface=false +target6.type=ClassTarget +target6.width=120 +target6.x=0 +target6.y=0 +version=3.0.0 +width=959 +world.lastInstantiated=SpaceWorld +xPosition=288 +yPosition=0