Merge remote-tracking branch 'origin/main'
# Conflicts: # SMIMS-Game/MyWorld.class # SMIMS-Game/MyWorld.java # SMIMS-Game/Player.class # SMIMS-Game/project.greenfoot
@@ -25,7 +25,7 @@ public class BreakingPlattform extends Plattform
|
|||||||
{
|
{
|
||||||
IsBreaking= true;
|
IsBreaking= true;
|
||||||
//Greenfoot.playSound("...")
|
//Greenfoot.playSound("...")
|
||||||
this.setImage("BreakingPlattform2.png");
|
this.setImage("Breaking2.png");
|
||||||
|
|
||||||
}
|
}
|
||||||
if(IsBreaking)
|
if(IsBreaking)
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
#BlueJ class context
|
#BlueJ class context
|
||||||
comment0.target=Enemy
|
comment0.target=Enemy
|
||||||
comment1.params=targetX\ targetY
|
comment1.params=
|
||||||
comment1.target=Enemy(int,\ int)
|
comment1.target=void\ act()
|
||||||
comment2.params=
|
comment2.params=
|
||||||
comment2.target=void\ act()
|
comment2.target=void\ shootAtPlayer()
|
||||||
comment3.params=targetX\ targetY
|
numComments=3
|
||||||
comment3.target=void\ moveToTargetLocation(int,\ int)
|
|
||||||
comment4.params=
|
|
||||||
comment4.target=void\ shootAtPlayer()
|
|
||||||
numComments=5
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class GameOverWorld extends World
|
|||||||
private void prepare()
|
private void prepare()
|
||||||
{
|
{
|
||||||
Button button = new Button();
|
Button button = new Button();
|
||||||
addObject(button,200,350);
|
addObject(button,200,320);
|
||||||
button.setImage("Neustart.png");
|
button.setImage("Neustart.png");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#BlueJ class context
|
||||||
|
comment0.target=Heart
|
||||||
|
comment0.text=\r\n\ Write\ a\ description\ of\ class\ Heart\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
|
||||||
|
comment1.params=
|
||||||
|
comment1.target=void\ act()
|
||||||
|
comment1.text=\r\n\ Act\ -\ do\ whatever\ the\ Heart\ wants\ to\ do.\ This\ method\ is\ called\ whenever\r\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\r\n
|
||||||
|
numComments=2
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a description of class Heart here.
|
||||||
|
*
|
||||||
|
* @author (your name)
|
||||||
|
* @version (a version number or a date)
|
||||||
|
*/
|
||||||
|
public class Heart extends Actor
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Act - do whatever the Heart 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.
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -58,6 +58,12 @@ public class MyWorld extends World
|
|||||||
plattform2.setLocation(308,382);
|
plattform2.setLocation(308,382);
|
||||||
Healthbar healthbar = new Healthbar();
|
Healthbar healthbar = new Healthbar();
|
||||||
addObject(healthbar,50,50);
|
addObject(healthbar,50,50);
|
||||||
|
Heart heart = new Heart();
|
||||||
|
addObject(heart,371,27);
|
||||||
|
Heart heart2 = new Heart();
|
||||||
|
addObject(heart2,343,27);
|
||||||
|
Heart heart3 = new Heart();
|
||||||
|
addObject(heart3,314,27);
|
||||||
|
|
||||||
addObject(new TemporaryGround(60*50), 200, 575);
|
addObject(new TemporaryGround(60*50), 200, 575);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,12 +112,17 @@ public class Player extends Actor
|
|||||||
|
|
||||||
public void collision(){
|
public void collision(){
|
||||||
if (getIntersectingObjects(Projectile.class).size()>0
|
if (getIntersectingObjects(Projectile.class).size()>0
|
||||||
|| getIntersectingObjects(Enemy.class).size()>0)
|
|| getIntersectingObjects(Enemy.class).size()>0
|
||||||
|
|| getIntersectingObjects(Spike.class).size()>0)
|
||||||
{
|
{
|
||||||
health--;
|
health--;
|
||||||
getWorld().removeObjects(getIntersectingObjects(Projectile.class));
|
getWorld().removeObjects(getIntersectingObjects(Projectile.class));
|
||||||
getWorld().removeObjects(getIntersectingObjects(Enemy.class));
|
getWorld().removeObjects(getIntersectingObjects(Enemy.class));
|
||||||
|
getWorld().removeObjects(getIntersectingObjects(Spike.class));
|
||||||
|
getWorld().removeObject(getWorld().getObjects(Heart.class).get(0));
|
||||||
|
//if(health<=2){
|
||||||
|
// getWorld().removeObject(getWorld().getObjects(Heart.class).get(0));
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,6 @@ public class Spike extends Actor
|
|||||||
*/
|
*/
|
||||||
public void act()
|
public void act()
|
||||||
{
|
{
|
||||||
// Add your action code here.
|
|
||||||
if(this.isTouching(Player.class))
|
|
||||||
{
|
|
||||||
Greenfoot.setWorld(new GameOverWorld());
|
|
||||||
}
|
|
||||||
this.bewege();
|
this.bewege();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class StartWorld extends World
|
|||||||
private void prepare()
|
private void prepare()
|
||||||
{
|
{
|
||||||
Button button = new Button();
|
Button button = new Button();
|
||||||
addObject(button,200,350);
|
addObject(button,200,320);
|
||||||
button.setImage("Start.png");
|
button.setImage("Start.png");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class UnactiveSpike extends Actor
|
|||||||
MyWorld theWorld= (MyWorld) this.getWorld();
|
MyWorld theWorld= (MyWorld) this.getWorld();
|
||||||
Spike BeispielSpike=new Spike(1);
|
Spike BeispielSpike=new Spike(1);
|
||||||
GreenfootImage SpikeImage= BeispielSpike.getImage();
|
GreenfootImage SpikeImage= BeispielSpike.getImage();
|
||||||
theWorld.addObject(new Spike(speed), this.getX(), (this.getY()- this.getImage().getHeight()/2)-10); //die Zahl Minus damit ist endlich passt
|
theWorld.addObject(new Spike(speed), this.getX(), (this.getY()- this.getImage().getHeight()/2)-2); //die Zahl Minus damit ist endlich passt
|
||||||
geloescht=true;
|
geloescht=true;
|
||||||
}
|
}
|
||||||
if(geloescht)
|
if(geloescht)
|
||||||
|
|||||||
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 160 KiB After Width: | Height: | Size: 272 KiB |
|
After Width: | Height: | Size: 329 B |
|
After Width: | Height: | Size: 578 B |
@@ -1,7 +1,7 @@
|
|||||||
#Greenfoot project file
|
#Greenfoot project file
|
||||||
class.BreakingPlattform.image=Unbenannt2.png
|
class.BreakingPlattform.image=Unbenannt2.png
|
||||||
class.Ground.image=weave.jpg
|
class.Ground.image=weave.jpg
|
||||||
class.Groundflower.image=flower2.png
|
class.Groundflower.image=beeper.png
|
||||||
class.MovingPlattform.image=Unbenannt.png
|
class.MovingPlattform.image=Unbenannt.png
|
||||||
class.Plattform.image=Plattform.png
|
class.Plattform.image=Plattform.png
|
||||||
class.Player.image=ppl2.png
|
class.Player.image=ppl2.png
|
||||||
@@ -13,128 +13,119 @@ dependency1.from=PlayerTestWorld
|
|||||||
dependency1.to=Ground
|
dependency1.to=Ground
|
||||||
dependency1.type=UsesDependency
|
dependency1.type=UsesDependency
|
||||||
dependency10.from=MyWorld
|
dependency10.from=MyWorld
|
||||||
dependency10.to=BreakingPlattform
|
dependency10.to=SpikedPlattform
|
||||||
dependency10.type=UsesDependency
|
dependency10.type=UsesDependency
|
||||||
dependency11.from=MyWorld
|
dependency11.from=MyWorld
|
||||||
dependency11.to=SpikedPlattform
|
dependency11.to=Projectile
|
||||||
dependency11.type=UsesDependency
|
dependency11.type=UsesDependency
|
||||||
dependency12.from=MyWorld
|
dependency12.from=MyWorld
|
||||||
dependency12.to=Groundflower
|
dependency12.to=TargetingProjectile
|
||||||
dependency12.type=UsesDependency
|
dependency12.type=UsesDependency
|
||||||
dependency13.from=MyWorld
|
dependency13.from=GameOverWorld
|
||||||
dependency13.to=Projectile
|
dependency13.to=Button
|
||||||
dependency13.type=UsesDependency
|
dependency13.type=UsesDependency
|
||||||
dependency14.from=MyWorld
|
dependency14.from=StartWorld
|
||||||
dependency14.to=TargetingProjectile
|
dependency14.to=Button
|
||||||
dependency14.type=UsesDependency
|
dependency14.type=UsesDependency
|
||||||
dependency15.from=GameOverWorld
|
dependency15.from=UnactiveSpike
|
||||||
dependency15.to=Button
|
dependency15.to=SpikedPlattform
|
||||||
dependency15.type=UsesDependency
|
dependency15.type=UsesDependency
|
||||||
dependency16.from=StartWorld
|
dependency16.from=UnactiveSpike
|
||||||
dependency16.to=Button
|
dependency16.to=MyWorld
|
||||||
dependency16.type=UsesDependency
|
dependency16.type=UsesDependency
|
||||||
dependency17.from=UnactiveSpike
|
dependency17.from=UnactiveSpike
|
||||||
dependency17.to=SpikedPlattform
|
dependency17.to=Spike
|
||||||
dependency17.type=UsesDependency
|
dependency17.type=UsesDependency
|
||||||
dependency18.from=UnactiveSpike
|
dependency18.from=Button
|
||||||
dependency18.to=MyWorld
|
dependency18.to=MyWorld
|
||||||
dependency18.type=UsesDependency
|
dependency18.type=UsesDependency
|
||||||
dependency19.from=UnactiveSpike
|
dependency19.from=PowerUps
|
||||||
dependency19.to=Spike
|
dependency19.to=Player
|
||||||
dependency19.type=UsesDependency
|
dependency19.type=UsesDependency
|
||||||
dependency2.from=PlayerTestWorld
|
dependency2.from=PlayerTestWorld
|
||||||
dependency2.to=Player
|
dependency2.to=Player
|
||||||
dependency2.type=UsesDependency
|
dependency2.type=UsesDependency
|
||||||
dependency20.from=Button
|
dependency20.from=HealthItem
|
||||||
dependency20.to=MyWorld
|
dependency20.to=Player
|
||||||
dependency20.type=UsesDependency
|
dependency20.type=UsesDependency
|
||||||
dependency21.from=PowerUps
|
dependency21.from=JumpBoostItem
|
||||||
dependency21.to=Player
|
dependency21.to=Player
|
||||||
dependency21.type=UsesDependency
|
dependency21.type=UsesDependency
|
||||||
dependency22.from=HealthItem
|
dependency22.from=Groundflower
|
||||||
dependency22.to=Player
|
dependency22.to=Player
|
||||||
dependency22.type=UsesDependency
|
dependency22.type=UsesDependency
|
||||||
dependency23.from=JumpBoostItem
|
dependency23.from=Enemy
|
||||||
dependency23.to=Player
|
dependency23.to=Player
|
||||||
dependency23.type=UsesDependency
|
dependency23.type=UsesDependency
|
||||||
dependency24.from=Groundflower
|
dependency24.from=Enemy
|
||||||
dependency24.to=Player
|
dependency24.to=EnemyProjectile
|
||||||
dependency24.type=UsesDependency
|
dependency24.type=UsesDependency
|
||||||
dependency25.from=Enemy
|
dependency25.from=Spike
|
||||||
dependency25.to=Player
|
dependency25.to=GameOverWorld
|
||||||
dependency25.type=UsesDependency
|
dependency25.type=UsesDependency
|
||||||
dependency26.from=Enemy
|
dependency26.from=Spike
|
||||||
dependency26.to=EnemyProjectile
|
dependency26.to=MyWorld
|
||||||
dependency26.type=UsesDependency
|
dependency26.type=UsesDependency
|
||||||
dependency27.from=Spike
|
dependency27.from=Spike
|
||||||
dependency27.to=GameOverWorld
|
dependency27.to=Player
|
||||||
dependency27.type=UsesDependency
|
dependency27.type=UsesDependency
|
||||||
dependency28.from=Spike
|
dependency28.from=Player
|
||||||
dependency28.to=MyWorld
|
dependency28.to=GameOverWorld
|
||||||
dependency28.type=UsesDependency
|
dependency28.type=UsesDependency
|
||||||
dependency29.from=Spike
|
dependency29.from=Player
|
||||||
dependency29.to=Player
|
dependency29.to=Plattform
|
||||||
dependency29.type=UsesDependency
|
dependency29.type=UsesDependency
|
||||||
dependency3.from=PlayerTestWorld
|
dependency3.from=PlayerTestWorld
|
||||||
dependency3.to=JumpBoostItem
|
dependency3.to=JumpBoostItem
|
||||||
dependency3.type=UsesDependency
|
dependency3.type=UsesDependency
|
||||||
dependency30.from=Player
|
dependency30.from=Player
|
||||||
dependency30.to=GameOverWorld
|
dependency30.to=PlayerProjectile
|
||||||
dependency30.type=UsesDependency
|
dependency30.type=UsesDependency
|
||||||
dependency31.from=Player
|
dependency31.from=Player
|
||||||
dependency31.to=Plattform
|
dependency31.to=TemporaryGround
|
||||||
dependency31.type=UsesDependency
|
dependency31.type=UsesDependency
|
||||||
dependency32.from=Player
|
dependency32.from=Player
|
||||||
dependency32.to=PlayerProjectile
|
dependency32.to=Projectile
|
||||||
dependency32.type=UsesDependency
|
dependency32.type=UsesDependency
|
||||||
dependency33.from=Player
|
dependency33.from=Player
|
||||||
dependency33.to=TemporaryGround
|
dependency33.to=Enemy
|
||||||
dependency33.type=UsesDependency
|
dependency33.type=UsesDependency
|
||||||
dependency34.from=Player
|
dependency34.from=Healthbar
|
||||||
dependency34.to=Projectile
|
dependency34.to=Player
|
||||||
dependency34.type=UsesDependency
|
dependency34.type=UsesDependency
|
||||||
dependency35.from=Player
|
dependency35.from=Plattform
|
||||||
dependency35.to=Enemy
|
dependency35.to=MyWorld
|
||||||
dependency35.type=UsesDependency
|
dependency35.type=UsesDependency
|
||||||
dependency36.from=Healthbar
|
dependency36.from=Plattform
|
||||||
dependency36.to=Player
|
dependency36.to=Player
|
||||||
dependency36.type=UsesDependency
|
dependency36.type=UsesDependency
|
||||||
dependency37.from=Plattform
|
dependency37.from=MovingPlattform
|
||||||
dependency37.to=MyWorld
|
dependency37.to=MyWorld
|
||||||
dependency37.type=UsesDependency
|
dependency37.type=UsesDependency
|
||||||
dependency38.from=Plattform
|
dependency38.from=MovingPlattform
|
||||||
dependency38.to=Player
|
dependency38.to=Player
|
||||||
dependency38.type=UsesDependency
|
dependency38.type=UsesDependency
|
||||||
dependency39.from=MovingPlattform
|
dependency39.from=SpikedPlattform
|
||||||
dependency39.to=MyWorld
|
dependency39.to=Spike
|
||||||
dependency39.type=UsesDependency
|
dependency39.type=UsesDependency
|
||||||
dependency4.from=MyWorld
|
dependency4.from=MyWorld
|
||||||
dependency4.to=Player
|
dependency4.to=Player
|
||||||
dependency4.type=UsesDependency
|
dependency4.type=UsesDependency
|
||||||
dependency40.from=MovingPlattform
|
dependency40.from=SpikedPlattform
|
||||||
dependency40.to=Player
|
dependency40.to=GameOverWorld
|
||||||
dependency40.type=UsesDependency
|
dependency40.type=UsesDependency
|
||||||
dependency41.from=TemporaryGround
|
dependency41.from=SpikedPlattform
|
||||||
dependency41.to=Player
|
dependency41.to=MyWorld
|
||||||
dependency41.type=UsesDependency
|
dependency41.type=UsesDependency
|
||||||
dependency42.from=SpikedPlattform
|
dependency42.from=SpikedPlattform
|
||||||
dependency42.to=Spike
|
dependency42.to=UnactiveSpike
|
||||||
dependency42.type=UsesDependency
|
dependency42.type=UsesDependency
|
||||||
dependency43.from=SpikedPlattform
|
dependency43.from=TargetingProjectile
|
||||||
dependency43.to=GameOverWorld
|
dependency43.to=Player
|
||||||
dependency43.type=UsesDependency
|
dependency43.type=UsesDependency
|
||||||
dependency44.from=SpikedPlattform
|
dependency44.from=PlayerProjectile
|
||||||
dependency44.to=MyWorld
|
dependency44.to=Enemy
|
||||||
dependency44.type=UsesDependency
|
dependency44.type=UsesDependency
|
||||||
dependency45.from=SpikedPlattform
|
|
||||||
dependency45.to=UnactiveSpike
|
|
||||||
dependency45.type=UsesDependency
|
|
||||||
dependency46.from=TargetingProjectile
|
|
||||||
dependency46.to=Player
|
|
||||||
dependency46.type=UsesDependency
|
|
||||||
dependency47.from=PlayerProjectile
|
|
||||||
dependency47.to=Enemy
|
|
||||||
dependency47.type=UsesDependency
|
|
||||||
dependency5.from=MyWorld
|
dependency5.from=MyWorld
|
||||||
dependency5.to=Score
|
dependency5.to=Score
|
||||||
dependency5.type=UsesDependency
|
dependency5.type=UsesDependency
|
||||||
@@ -145,17 +136,17 @@ dependency7.from=MyWorld
|
|||||||
dependency7.to=Healthbar
|
dependency7.to=Healthbar
|
||||||
dependency7.type=UsesDependency
|
dependency7.type=UsesDependency
|
||||||
dependency8.from=MyWorld
|
dependency8.from=MyWorld
|
||||||
dependency8.to=TemporaryGround
|
dependency8.to=MovingPlattform
|
||||||
dependency8.type=UsesDependency
|
dependency8.type=UsesDependency
|
||||||
dependency9.from=MyWorld
|
dependency9.from=MyWorld
|
||||||
dependency9.to=MovingPlattform
|
dependency9.to=BreakingPlattform
|
||||||
dependency9.type=UsesDependency
|
dependency9.type=UsesDependency
|
||||||
editor.fx.0.height=1048
|
editor.fx.0.height=739
|
||||||
editor.fx.0.width=1936
|
editor.fx.0.width=816
|
||||||
editor.fx.0.x=-8
|
editor.fx.0.x=552
|
||||||
editor.fx.0.y=-8
|
editor.fx.0.y=98
|
||||||
height=1048
|
height=1048
|
||||||
package.numDependencies=47
|
package.numDependencies=44
|
||||||
package.numTargets=25
|
package.numTargets=25
|
||||||
project.charset=UTF-8
|
project.charset=UTF-8
|
||||||
publish.hasSource=false
|
publish.hasSource=false
|
||||||
|
|||||||