Merge remote-tracking branch 'origin/main'
# Conflicts: # SMIMS-Game/Player.class # SMIMS-Game/Player.java # SMIMS-Game/project.greenfoot
This commit is contained in:
@@ -25,7 +25,7 @@ public class BreakingPlattform extends Plattform
|
|||||||
{
|
{
|
||||||
IsBreaking= true;
|
IsBreaking= true;
|
||||||
//Greenfoot.playSound("...")
|
//Greenfoot.playSound("...")
|
||||||
this.setImage("BreakingPlattform2.png"); //untested
|
this.setImage("BreakingPlattform2.png");
|
||||||
|
|
||||||
}
|
}
|
||||||
if(IsBreaking)
|
if(IsBreaking)
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,11 @@
|
|||||||
|
#BlueJ class context
|
||||||
|
comment0.target=Groundflower
|
||||||
|
comment0.text=\r\n\ Write\ a\ description\ of\ class\ StarPowerUp\ 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\ StarPowerUp\ wants\ to\ do.\ This\ method\ is\ called\ whenever\r\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\r\n
|
||||||
|
comment2.params=
|
||||||
|
comment2.target=void\ collect()
|
||||||
|
comment3.params=
|
||||||
|
comment3.target=void\ bewegeNachUnten()
|
||||||
|
numComments=4
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a description of class StarPowerUp here.
|
||||||
|
*
|
||||||
|
* @author (your name)
|
||||||
|
* @version (a version number or a date)
|
||||||
|
*/
|
||||||
|
public class Groundflower extends PowerUps
|
||||||
|
{
|
||||||
|
int duration= 60*8; //15 Sekunden
|
||||||
|
/**
|
||||||
|
* Act - do whatever the StarPowerUp wants to do. This method is called whenever
|
||||||
|
* the 'Act' or 'Run' button gets pressed in the environment.
|
||||||
|
*/
|
||||||
|
public void act()
|
||||||
|
{
|
||||||
|
bewegeNachUnten();
|
||||||
|
this.touchedByPlayer();
|
||||||
|
// Add your action code here.
|
||||||
|
}
|
||||||
|
|
||||||
|
@ Override void collect()
|
||||||
|
{
|
||||||
|
Player player = getIntersectingObjects(Player.class).get(0);
|
||||||
|
player.reveivePowerUp(duration, "GroundPower");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bewegeNachUnten()
|
||||||
|
{
|
||||||
|
this.setLocation(this.getX(), this.getY()+2);
|
||||||
|
if(this.getY()>=this.getWorld().getHeight())
|
||||||
|
{
|
||||||
|
this.getWorld().removeObject(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -9,7 +9,7 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
|||||||
public class MovingPlattform extends Plattform
|
public class MovingPlattform extends Plattform
|
||||||
{
|
{
|
||||||
int speed;
|
int speed;
|
||||||
|
int temp=0;
|
||||||
public MovingPlattform(int pSpeed)
|
public MovingPlattform(int pSpeed)
|
||||||
{
|
{
|
||||||
speed= pSpeed;
|
speed= pSpeed;
|
||||||
@@ -42,10 +42,11 @@ public class MovingPlattform extends Plattform
|
|||||||
{
|
{
|
||||||
if(this.PlayerOnPlattform())
|
if(this.PlayerOnPlattform())
|
||||||
{
|
{
|
||||||
Actor DerSpieler = this.getOneObjectAtOffset(0, -40, Player.class);
|
World theWorld= this.getWorld();
|
||||||
|
Player DerSpieler = theWorld.getObjects(Player.class).get(0);
|
||||||
if(DerSpieler!=null)
|
if(DerSpieler!=null)
|
||||||
{
|
{
|
||||||
DerSpieler.setLocation(DerSpieler.getX()+speed, DerSpieler.getY());
|
DerSpieler.setLocation(DerSpieler.getX()+speed*3, DerSpieler.getY());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -149,6 +149,16 @@ public class Player extends Actor
|
|||||||
if (health < MAX_HEALTH){
|
if (health < MAX_HEALTH){
|
||||||
health++;
|
health++;
|
||||||
}
|
}
|
||||||
|
case "GroundPower":
|
||||||
|
World theWorld= this.getWorld();
|
||||||
|
if(!theWorld.getObjects(TemporaryGround.class).isEmpty())
|
||||||
|
{
|
||||||
|
theWorld.getObjects(TemporaryGround.class).get(0).RefreshLifeToDuration(duration);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
theWorld.addObject((new TemporaryGround(duration)), 200, 550);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
|||||||
|
#BlueJ class context
|
||||||
|
comment0.target=TemporaryGround
|
||||||
|
comment0.text=\r\n\ Write\ a\ description\ of\ class\ TemporaryGround\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
|
||||||
|
comment1.params=pLebensdauer
|
||||||
|
comment1.target=TemporaryGround(int)
|
||||||
|
comment2.params=
|
||||||
|
comment2.target=void\ act()
|
||||||
|
comment2.text=\r\n\ Act\ -\ do\ whatever\ the\ TemporaryGround\ wants\ to\ do.\ This\ method\ is\ called\ whenever\r\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\r\n
|
||||||
|
comment3.params=
|
||||||
|
comment3.target=void\ warning()
|
||||||
|
comment4.params=
|
||||||
|
comment4.target=void\ noMoreWarning()
|
||||||
|
comment5.params=pDuration
|
||||||
|
comment5.target=void\ RefreshLifeToDuration(int)
|
||||||
|
numComments=6
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a description of class TemporaryGround here.
|
||||||
|
*
|
||||||
|
* @author (your name)
|
||||||
|
* @version (a version number or a date)
|
||||||
|
*/
|
||||||
|
public class TemporaryGround extends Plattform
|
||||||
|
{
|
||||||
|
private int Lebensdauer;
|
||||||
|
boolean warningHasHappend=false;
|
||||||
|
boolean deWarningHasHappend=true;
|
||||||
|
public TemporaryGround(int pLebensdauer)
|
||||||
|
{
|
||||||
|
Lebensdauer=pLebensdauer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Act - do whatever the TemporaryGround 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.
|
||||||
|
Lebensdauer--;
|
||||||
|
if(Lebensdauer==0)
|
||||||
|
{
|
||||||
|
this.loescheMich();
|
||||||
|
}
|
||||||
|
if(Lebensdauer<60*3 && warningHasHappend==false) //3 Sekunden
|
||||||
|
{
|
||||||
|
this.warning();
|
||||||
|
}
|
||||||
|
if(Lebensdauer>=60*3 && deWarningHasHappend==false)
|
||||||
|
{
|
||||||
|
this.noMoreWarning();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warning()
|
||||||
|
{
|
||||||
|
this.setImage("TemporaryIsBreaking.png");
|
||||||
|
warningHasHappend=true;
|
||||||
|
deWarningHasHappend=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void noMoreWarning()
|
||||||
|
{
|
||||||
|
this.setImage("TemporaryGround.png");
|
||||||
|
warningHasHappend=false;
|
||||||
|
deWarningHasHappend=true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RefreshLifeToDuration(int pDuration)
|
||||||
|
{
|
||||||
|
Lebensdauer=pDuration;
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@@ -9,57 +9,56 @@ class.MovingPlattform.image=Unbenannt.png
|
|||||||
class.MyWorld.image=GameBackground.png
|
class.MyWorld.image=GameBackground.png
|
||||||
class.Plattform.image=Platform1.png
|
class.Plattform.image=Platform1.png
|
||||||
class.Player.image=Player.png
|
class.Player.image=Player.png
|
||||||
class.PlayerProjectile.image=beeper.png
|
|
||||||
class.Projectile.image=Projectile1.png
|
class.Projectile.image=Projectile1.png
|
||||||
class.Spike.image=Spike.png
|
class.Spike.image=Spike.png
|
||||||
class.SpikedPlattform.image=SpikedPlattform.png
|
class.SpikedPlattform.image=SpikedPlattform.png
|
||||||
class.StartWorld.image=StartBackground.png
|
class.StartWorld.image=StartBackground.png
|
||||||
class.TargetingProjectile.image=blue-draught.png
|
class.TargetingProjectile.image=blue-draught.png
|
||||||
class.UnactiveSpike.image=Spike_Copy.png
|
class.UnactiveSpike.image=SpikeUnactive.png
|
||||||
dependency1.from=GameOverWorld
|
dependency1.from=GameOverWorld
|
||||||
dependency1.to=Button
|
dependency1.to=Button
|
||||||
dependency1.type=UsesDependency
|
dependency1.type=UsesDependency
|
||||||
dependency10.from=MyWorld
|
dependency10.from=MyWorld
|
||||||
dependency10.to=BreakingPlattform
|
dependency10.to=MovingPlattform
|
||||||
dependency10.type=UsesDependency
|
dependency10.type=UsesDependency
|
||||||
dependency11.from=MyWorld
|
dependency11.from=MyWorld
|
||||||
dependency11.to=SpikedPlattform
|
dependency11.to=BreakingPlattform
|
||||||
dependency11.type=UsesDependency
|
dependency11.type=UsesDependency
|
||||||
dependency12.from=MyWorld
|
dependency12.from=MyWorld
|
||||||
dependency12.to=Projectile
|
dependency12.to=SpikedPlattform
|
||||||
dependency12.type=UsesDependency
|
dependency12.type=UsesDependency
|
||||||
dependency13.from=MyWorld
|
dependency13.from=MyWorld
|
||||||
dependency13.to=TargetingProjectile
|
dependency13.to=Projectile
|
||||||
dependency13.type=UsesDependency
|
dependency13.type=UsesDependency
|
||||||
dependency14.from=Spike
|
dependency14.from=MyWorld
|
||||||
dependency14.to=GameOverWorld
|
dependency14.to=TargetingProjectile
|
||||||
dependency14.type=UsesDependency
|
dependency14.type=UsesDependency
|
||||||
dependency15.from=Spike
|
dependency15.from=Spike
|
||||||
dependency15.to=MyWorld
|
dependency15.to=GameOverWorld
|
||||||
dependency15.type=UsesDependency
|
dependency15.type=UsesDependency
|
||||||
dependency16.from=Spike
|
dependency16.from=Spike
|
||||||
dependency16.to=Player
|
dependency16.to=MyWorld
|
||||||
dependency16.type=UsesDependency
|
dependency16.type=UsesDependency
|
||||||
dependency17.from=Player
|
dependency17.from=Spike
|
||||||
dependency17.to=GameOverWorld
|
dependency17.to=Player
|
||||||
dependency17.type=UsesDependency
|
dependency17.type=UsesDependency
|
||||||
dependency18.from=Player
|
dependency18.from=Player
|
||||||
dependency18.to=Plattform
|
dependency18.to=GameOverWorld
|
||||||
dependency18.type=UsesDependency
|
dependency18.type=UsesDependency
|
||||||
dependency19.from=Player
|
dependency19.from=Player
|
||||||
dependency19.to=PlayerProjectile
|
dependency19.to=Plattform
|
||||||
dependency19.type=UsesDependency
|
dependency19.type=UsesDependency
|
||||||
dependency2.from=PlayerTestWorld
|
dependency2.from=PlayerTestWorld
|
||||||
dependency2.to=Ground
|
dependency2.to=Ground
|
||||||
dependency2.type=UsesDependency
|
dependency2.type=UsesDependency
|
||||||
dependency20.from=Player
|
dependency20.from=Player
|
||||||
dependency20.to=Projectile
|
dependency20.to=PlayerProjectile
|
||||||
dependency20.type=UsesDependency
|
dependency20.type=UsesDependency
|
||||||
dependency21.from=Player
|
dependency21.from=Player
|
||||||
dependency21.to=Enemy
|
dependency21.to=Projectile
|
||||||
dependency21.type=UsesDependency
|
dependency21.type=UsesDependency
|
||||||
dependency22.from=Healthbar
|
dependency22.from=Player
|
||||||
dependency22.to=Player
|
dependency22.to=Enemy
|
||||||
dependency22.type=UsesDependency
|
dependency22.type=UsesDependency
|
||||||
dependency23.from=UnactiveSpike
|
dependency23.from=UnactiveSpike
|
||||||
dependency23.to=SpikedPlattform
|
dependency23.to=SpikedPlattform
|
||||||
@@ -70,60 +69,63 @@ dependency24.type=UsesDependency
|
|||||||
dependency25.from=UnactiveSpike
|
dependency25.from=UnactiveSpike
|
||||||
dependency25.to=Spike
|
dependency25.to=Spike
|
||||||
dependency25.type=UsesDependency
|
dependency25.type=UsesDependency
|
||||||
dependency26.from=Plattform
|
dependency26.from=Healthbar
|
||||||
dependency26.to=MyWorld
|
dependency26.to=Player
|
||||||
dependency26.type=UsesDependency
|
dependency26.type=UsesDependency
|
||||||
dependency27.from=Plattform
|
dependency27.from=Plattform
|
||||||
dependency27.to=Player
|
dependency27.to=MyWorld
|
||||||
dependency27.type=UsesDependency
|
dependency27.type=UsesDependency
|
||||||
dependency28.from=MovingPlattform
|
dependency28.from=Plattform
|
||||||
dependency28.to=MyWorld
|
dependency28.to=Player
|
||||||
dependency28.type=UsesDependency
|
dependency28.type=UsesDependency
|
||||||
dependency29.from=MovingPlattform
|
dependency29.from=MovingPlattform
|
||||||
dependency29.to=Player
|
dependency29.to=MyWorld
|
||||||
dependency29.type=UsesDependency
|
dependency29.type=UsesDependency
|
||||||
dependency3.from=PlayerTestWorld
|
dependency3.from=PlayerTestWorld
|
||||||
dependency3.to=Player
|
dependency3.to=Player
|
||||||
dependency3.type=UsesDependency
|
dependency3.type=UsesDependency
|
||||||
dependency30.from=SpikedPlattform
|
dependency30.from=MovingPlattform
|
||||||
dependency30.to=Spike
|
dependency30.to=Player
|
||||||
dependency30.type=UsesDependency
|
dependency30.type=UsesDependency
|
||||||
dependency31.from=SpikedPlattform
|
dependency31.from=SpikedPlattform
|
||||||
dependency31.to=GameOverWorld
|
dependency31.to=Spike
|
||||||
dependency31.type=UsesDependency
|
dependency31.type=UsesDependency
|
||||||
dependency32.from=SpikedPlattform
|
dependency32.from=SpikedPlattform
|
||||||
dependency32.to=MyWorld
|
dependency32.to=GameOverWorld
|
||||||
dependency32.type=UsesDependency
|
dependency32.type=UsesDependency
|
||||||
dependency33.from=SpikedPlattform
|
dependency33.from=SpikedPlattform
|
||||||
dependency33.to=UnactiveSpike
|
dependency33.to=MyWorld
|
||||||
dependency33.type=UsesDependency
|
dependency33.type=UsesDependency
|
||||||
dependency34.from=TargetingProjectile
|
dependency34.from=SpikedPlattform
|
||||||
dependency34.to=Player
|
dependency34.to=UnactiveSpike
|
||||||
dependency34.type=UsesDependency
|
dependency34.type=UsesDependency
|
||||||
dependency35.from=Button
|
dependency35.from=TargetingProjectile
|
||||||
dependency35.to=MyWorld
|
dependency35.to=Player
|
||||||
dependency35.type=UsesDependency
|
dependency35.type=UsesDependency
|
||||||
dependency36.from=PowerUps
|
dependency36.from=Button
|
||||||
dependency36.to=Player
|
dependency36.to=MyWorld
|
||||||
dependency36.type=UsesDependency
|
dependency36.type=UsesDependency
|
||||||
dependency37.from=HealthItem
|
dependency37.from=PowerUps
|
||||||
dependency37.to=Player
|
dependency37.to=Player
|
||||||
dependency37.type=UsesDependency
|
dependency37.type=UsesDependency
|
||||||
dependency38.from=JumpBoostItem
|
dependency38.from=HealthItem
|
||||||
dependency38.to=Player
|
dependency38.to=Player
|
||||||
dependency38.type=UsesDependency
|
dependency38.type=UsesDependency
|
||||||
dependency39.from=Enemy
|
dependency39.from=JumpBoostItem
|
||||||
dependency39.to=Player
|
dependency39.to=Player
|
||||||
dependency39.type=UsesDependency
|
dependency39.type=UsesDependency
|
||||||
dependency4.from=PlayerTestWorld
|
dependency4.from=PlayerTestWorld
|
||||||
dependency4.to=JumpBoostItem
|
dependency4.to=JumpBoostItem
|
||||||
dependency4.type=UsesDependency
|
dependency4.type=UsesDependency
|
||||||
dependency40.from=Enemy
|
dependency40.from=Enemy
|
||||||
dependency40.to=EnemyProjectile
|
dependency40.to=Player
|
||||||
dependency40.type=UsesDependency
|
dependency40.type=UsesDependency
|
||||||
dependency41.from=PlayerProjectile
|
dependency41.from=Enemy
|
||||||
dependency41.to=Enemy
|
dependency41.to=EnemyProjectile
|
||||||
dependency41.type=UsesDependency
|
dependency41.type=UsesDependency
|
||||||
|
dependency42.from=PlayerProjectile
|
||||||
|
dependency42.to=Enemy
|
||||||
|
dependency42.type=UsesDependency
|
||||||
dependency5.from=StartWorld
|
dependency5.from=StartWorld
|
||||||
dependency5.to=Button
|
dependency5.to=Button
|
||||||
dependency5.type=UsesDependency
|
dependency5.type=UsesDependency
|
||||||
@@ -137,14 +139,14 @@ dependency8.from=MyWorld
|
|||||||
dependency8.to=Plattform
|
dependency8.to=Plattform
|
||||||
dependency8.type=UsesDependency
|
dependency8.type=UsesDependency
|
||||||
dependency9.from=MyWorld
|
dependency9.from=MyWorld
|
||||||
dependency9.to=MovingPlattform
|
dependency9.to=Healthbar
|
||||||
dependency9.type=UsesDependency
|
dependency9.type=UsesDependency
|
||||||
editor.fx.0.height=737
|
editor.fx.0.height=737
|
||||||
editor.fx.0.width=814
|
editor.fx.0.width=814
|
||||||
editor.fx.0.x=330
|
editor.fx.0.x=360
|
||||||
editor.fx.0.y=72
|
editor.fx.0.y=26
|
||||||
height=830
|
height=822
|
||||||
package.numDependencies=41
|
package.numDependencies=42
|
||||||
package.numTargets=23
|
package.numTargets=23
|
||||||
project.charset=UTF-8
|
project.charset=UTF-8
|
||||||
publish.hasSource=false
|
publish.hasSource=false
|
||||||
@@ -287,7 +289,7 @@ target4.width=120
|
|||||||
target4.x=0
|
target4.x=0
|
||||||
target4.y=0
|
target4.y=0
|
||||||
target5.height=70
|
target5.height=70
|
||||||
target5.name=Healthbar
|
target5.name=UnactiveSpike
|
||||||
target5.showInterface=false
|
target5.showInterface=false
|
||||||
target5.type=ClassTarget
|
target5.type=ClassTarget
|
||||||
target5.width=120
|
target5.width=120
|
||||||
@@ -301,7 +303,7 @@ target6.width=120
|
|||||||
target6.x=0
|
target6.x=0
|
||||||
target6.y=0
|
target6.y=0
|
||||||
target7.height=70
|
target7.height=70
|
||||||
target7.name=UnactiveSpike
|
target7.name=Healthbar
|
||||||
target7.showInterface=false
|
target7.showInterface=false
|
||||||
target7.type=ClassTarget
|
target7.type=ClassTarget
|
||||||
target7.width=120
|
target7.width=120
|
||||||
@@ -322,7 +324,7 @@ target9.width=120
|
|||||||
target9.x=0
|
target9.x=0
|
||||||
target9.y=0
|
target9.y=0
|
||||||
version=3.1.0
|
version=3.1.0
|
||||||
width=1550
|
width=715
|
||||||
world.lastInstantiated=MyWorld
|
world.lastInstantiated=MyWorld
|
||||||
xPosition=0
|
xPosition=532
|
||||||
yPosition=0
|
yPosition=117
|
||||||
|
|||||||
Reference in New Issue
Block a user