Startplattform (nicht in MyWorld)
This commit is contained in:
@@ -25,7 +25,7 @@ public class BreakingPlattform extends Plattform
|
||||
{
|
||||
IsBreaking= true;
|
||||
//Greenfoot.playSound("...")
|
||||
this.setImage("BreakingPlattform2.png"); //untested
|
||||
this.setImage("BreakingPlattform2.png");
|
||||
|
||||
}
|
||||
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.
@@ -50,6 +50,7 @@ public class MyWorld extends World
|
||||
plattform2.setLocation(320,367);
|
||||
plattform2.setLocation(312,371);
|
||||
plattform2.setLocation(308,382);
|
||||
|
||||
}
|
||||
|
||||
public void act()
|
||||
@@ -83,6 +84,7 @@ public class MyWorld extends World
|
||||
addObject(new SpikedPlattform(100), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void projectile(){
|
||||
|
||||
Binary file not shown.
+11
-1
@@ -89,7 +89,7 @@ public class Player extends Actor
|
||||
}
|
||||
}
|
||||
onGround = landed;
|
||||
}
|
||||
}
|
||||
|
||||
public void shootProjectile(){
|
||||
projectileTimer++;
|
||||
@@ -135,6 +135,16 @@ public class Player extends Actor
|
||||
currentJumpStrength = defaultJumpStrength;
|
||||
currentJumpStrength += jumpBoostStrength;
|
||||
jumpBoostDuration = duration;
|
||||
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 |
+145
-67
@@ -1,85 +1,128 @@
|
||||
#Greenfoot project file
|
||||
class.BreakingPlattform.image=Unbenannt2.png
|
||||
class.Button.image=button-red.png
|
||||
class.GameOverWorld.image=GameOverBackground.png
|
||||
class.Ground.image=weave.jpg
|
||||
class.JumpBoostItem.image=mushroom.png
|
||||
class.Groundflower.image=beeper.png
|
||||
class.MovingPlattform.image=Unbenannt.png
|
||||
class.MyWorld.image=GameBackground.png
|
||||
class.Plattform.image=Plattform.png
|
||||
class.Player.image=ppl2.png
|
||||
class.Projectile.image=Projectile1.png
|
||||
class.Spike.image=Spike.png
|
||||
class.SpikedPlattform.image=SpikedPlattform.png
|
||||
class.StartWorld.image=StartBackground.png
|
||||
class.TargetingProjectile.image=blue-draught.png
|
||||
class.UnactiveSpike.image=SpikeUnactive.png
|
||||
class.TemporaryGround.image=TemporaryGround.png
|
||||
class.UnactiveSpike.image=Spike_Copy.png
|
||||
dependency1.from=GameOverWorld
|
||||
dependency1.to=Button
|
||||
dependency1.type=UsesDependency
|
||||
dependency10.from=MyWorld
|
||||
dependency10.to=BreakingPlattform
|
||||
dependency10.to=MovingPlattform
|
||||
dependency10.type=UsesDependency
|
||||
dependency11.from=MyWorld
|
||||
dependency11.to=Projectile
|
||||
dependency11.to=BreakingPlattform
|
||||
dependency11.type=UsesDependency
|
||||
dependency12.from=MyWorld
|
||||
dependency12.to=TargetingProjectile
|
||||
dependency12.to=SpikedPlattform
|
||||
dependency12.type=UsesDependency
|
||||
dependency13.from=Spike
|
||||
dependency13.to=GameOverWorld
|
||||
dependency13.from=MyWorld
|
||||
dependency13.to=Groundflower
|
||||
dependency13.type=UsesDependency
|
||||
dependency14.from=Spike
|
||||
dependency14.to=Player
|
||||
dependency14.from=MyWorld
|
||||
dependency14.to=Projectile
|
||||
dependency14.type=UsesDependency
|
||||
dependency15.from=Player
|
||||
dependency15.to=GameOverWorld
|
||||
dependency15.from=MyWorld
|
||||
dependency15.to=TargetingProjectile
|
||||
dependency15.type=UsesDependency
|
||||
dependency16.from=Player
|
||||
dependency16.to=Plattform
|
||||
dependency16.from=Spike
|
||||
dependency16.to=GameOverWorld
|
||||
dependency16.type=UsesDependency
|
||||
dependency17.from=Player
|
||||
dependency17.to=Projectile
|
||||
dependency17.from=Spike
|
||||
dependency17.to=MyWorld
|
||||
dependency17.type=UsesDependency
|
||||
dependency18.from=Plattform
|
||||
dependency18.to=MyWorld
|
||||
dependency18.from=Spike
|
||||
dependency18.to=Player
|
||||
dependency18.type=UsesDependency
|
||||
dependency19.from=Plattform
|
||||
dependency19.to=Player
|
||||
dependency19.from=Player
|
||||
dependency19.to=GameOverWorld
|
||||
dependency19.type=UsesDependency
|
||||
dependency2.from=PlayerTestWorld
|
||||
dependency2.to=Ground
|
||||
dependency2.type=UsesDependency
|
||||
dependency20.from=MovingPlattform
|
||||
dependency20.to=MyWorld
|
||||
dependency20.from=Player
|
||||
dependency20.to=Plattform
|
||||
dependency20.type=UsesDependency
|
||||
dependency21.from=SpikedPlattform
|
||||
dependency21.to=Spike
|
||||
dependency21.from=Player
|
||||
dependency21.to=PlayerProjectile
|
||||
dependency21.type=UsesDependency
|
||||
dependency22.from=SpikedPlattform
|
||||
dependency22.to=GameOverWorld
|
||||
dependency22.from=Player
|
||||
dependency22.to=TemporaryGround
|
||||
dependency22.type=UsesDependency
|
||||
dependency23.from=SpikedPlattform
|
||||
dependency23.to=MyWorld
|
||||
dependency23.from=Player
|
||||
dependency23.to=Projectile
|
||||
dependency23.type=UsesDependency
|
||||
dependency24.from=TargetingProjectile
|
||||
dependency24.to=Player
|
||||
dependency24.from=Player
|
||||
dependency24.to=Enemy
|
||||
dependency24.type=UsesDependency
|
||||
dependency25.from=Button
|
||||
dependency25.to=MyWorld
|
||||
dependency25.from=UnactiveSpike
|
||||
dependency25.to=SpikedPlattform
|
||||
dependency25.type=UsesDependency
|
||||
dependency26.from=PowerUps
|
||||
dependency26.to=Player
|
||||
dependency26.from=UnactiveSpike
|
||||
dependency26.to=MyWorld
|
||||
dependency26.type=UsesDependency
|
||||
dependency27.from=JumpBoostItem
|
||||
dependency27.to=Player
|
||||
dependency27.from=UnactiveSpike
|
||||
dependency27.to=Spike
|
||||
dependency27.type=UsesDependency
|
||||
dependency28.from=Plattform
|
||||
dependency28.to=MyWorld
|
||||
dependency28.type=UsesDependency
|
||||
dependency29.from=Plattform
|
||||
dependency29.to=Player
|
||||
dependency29.type=UsesDependency
|
||||
dependency3.from=PlayerTestWorld
|
||||
dependency3.to=Player
|
||||
dependency3.type=UsesDependency
|
||||
dependency30.from=MovingPlattform
|
||||
dependency30.to=MyWorld
|
||||
dependency30.type=UsesDependency
|
||||
dependency31.from=MovingPlattform
|
||||
dependency31.to=Player
|
||||
dependency31.type=UsesDependency
|
||||
dependency32.from=SpikedPlattform
|
||||
dependency32.to=Spike
|
||||
dependency32.type=UsesDependency
|
||||
dependency33.from=SpikedPlattform
|
||||
dependency33.to=GameOverWorld
|
||||
dependency33.type=UsesDependency
|
||||
dependency34.from=SpikedPlattform
|
||||
dependency34.to=MyWorld
|
||||
dependency34.type=UsesDependency
|
||||
dependency35.from=SpikedPlattform
|
||||
dependency35.to=UnactiveSpike
|
||||
dependency35.type=UsesDependency
|
||||
dependency36.from=TargetingProjectile
|
||||
dependency36.to=Player
|
||||
dependency36.type=UsesDependency
|
||||
dependency37.from=Button
|
||||
dependency37.to=MyWorld
|
||||
dependency37.type=UsesDependency
|
||||
dependency38.from=PowerUps
|
||||
dependency38.to=Player
|
||||
dependency38.type=UsesDependency
|
||||
dependency39.from=Groundflower
|
||||
dependency39.to=Player
|
||||
dependency39.type=UsesDependency
|
||||
dependency4.from=PlayerTestWorld
|
||||
dependency4.to=JumpBoostItem
|
||||
dependency4.type=UsesDependency
|
||||
dependency40.from=JumpBoostItem
|
||||
dependency40.to=Player
|
||||
dependency40.type=UsesDependency
|
||||
dependency41.from=Enemy
|
||||
dependency41.to=Player
|
||||
dependency41.type=UsesDependency
|
||||
dependency42.from=Enemy
|
||||
dependency42.to=EnemyProjectile
|
||||
dependency42.type=UsesDependency
|
||||
dependency43.from=PlayerProjectile
|
||||
dependency43.to=Enemy
|
||||
dependency43.type=UsesDependency
|
||||
dependency5.from=StartWorld
|
||||
dependency5.to=Button
|
||||
dependency5.type=UsesDependency
|
||||
@@ -93,15 +136,15 @@ dependency8.from=MyWorld
|
||||
dependency8.to=Plattform
|
||||
dependency8.type=UsesDependency
|
||||
dependency9.from=MyWorld
|
||||
dependency9.to=MovingPlattform
|
||||
dependency9.to=TemporaryGround
|
||||
dependency9.type=UsesDependency
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=814
|
||||
editor.fx.0.x=360
|
||||
editor.fx.0.y=26
|
||||
height=830
|
||||
package.numDependencies=27
|
||||
package.numTargets=18
|
||||
editor.fx.0.height=739
|
||||
editor.fx.0.width=816
|
||||
editor.fx.0.x=869
|
||||
editor.fx.0.y=190
|
||||
height=1048
|
||||
package.numDependencies=43
|
||||
package.numTargets=23
|
||||
project.charset=UTF-8
|
||||
publish.hasSource=false
|
||||
publish.locked=true
|
||||
@@ -124,68 +167,75 @@ target1.width=120
|
||||
target1.x=0
|
||||
target1.y=0
|
||||
target10.height=70
|
||||
target10.name=StartWorld
|
||||
target10.name=PlayerTestWorld
|
||||
target10.showInterface=false
|
||||
target10.type=ClassTarget
|
||||
target10.width=120
|
||||
target10.x=0
|
||||
target10.y=0
|
||||
target11.height=70
|
||||
target11.name=Plattform
|
||||
target11.name=StartWorld
|
||||
target11.showInterface=false
|
||||
target11.type=ClassTarget
|
||||
target11.width=120
|
||||
target11.x=0
|
||||
target11.y=0
|
||||
target12.height=70
|
||||
target12.name=TargetingProjectile
|
||||
target12.name=Plattform
|
||||
target12.showInterface=false
|
||||
target12.type=ClassTarget
|
||||
target12.width=120
|
||||
target12.x=0
|
||||
target12.y=0
|
||||
target13.height=70
|
||||
target13.name=Projectile
|
||||
target13.name=TargetingProjectile
|
||||
target13.showInterface=false
|
||||
target13.type=ClassTarget
|
||||
target13.width=120
|
||||
target13.x=0
|
||||
target13.y=0
|
||||
target14.height=70
|
||||
target14.name=Score
|
||||
target14.name=Projectile
|
||||
target14.showInterface=false
|
||||
target14.type=ClassTarget
|
||||
target14.width=120
|
||||
target14.x=0
|
||||
target14.y=0
|
||||
target15.height=70
|
||||
target15.name=Button
|
||||
target15.name=TemporaryGround
|
||||
target15.showInterface=false
|
||||
target15.type=ClassTarget
|
||||
target15.width=120
|
||||
target15.x=0
|
||||
target15.y=0
|
||||
target16.height=70
|
||||
target16.name=PowerUps
|
||||
target16.name=Score
|
||||
target16.showInterface=false
|
||||
target16.type=ClassTarget
|
||||
target16.width=120
|
||||
target16.x=0
|
||||
target16.y=0
|
||||
target17.height=70
|
||||
target17.name=SpikedPlattform
|
||||
target17.name=Button
|
||||
target17.showInterface=false
|
||||
target17.type=ClassTarget
|
||||
target17.width=120
|
||||
target17.x=0
|
||||
target17.y=0
|
||||
target18.height=70
|
||||
target18.name=MyWorld
|
||||
target18.name=EnemyProjectile
|
||||
target18.showInterface=false
|
||||
target18.type=ClassTarget
|
||||
target18.width=120
|
||||
target18.x=0
|
||||
target18.y=0
|
||||
target19.height=70
|
||||
target19.name=PowerUps
|
||||
target19.showInterface=false
|
||||
target19.type=ClassTarget
|
||||
target19.width=120
|
||||
target19.x=0
|
||||
target19.y=0
|
||||
target2.height=70
|
||||
target2.name=Player
|
||||
target2.showInterface=false
|
||||
@@ -193,57 +243,85 @@ target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=0
|
||||
target2.y=0
|
||||
target20.height=70
|
||||
target20.name=Enemy
|
||||
target20.showInterface=false
|
||||
target20.type=ClassTarget
|
||||
target20.width=120
|
||||
target20.x=0
|
||||
target20.y=0
|
||||
target21.height=70
|
||||
target21.name=PlayerProjectile
|
||||
target21.showInterface=false
|
||||
target21.type=ClassTarget
|
||||
target21.width=120
|
||||
target21.x=0
|
||||
target21.y=0
|
||||
target22.height=70
|
||||
target22.name=SpikedPlattform
|
||||
target22.showInterface=false
|
||||
target22.type=ClassTarget
|
||||
target22.width=120
|
||||
target22.x=0
|
||||
target22.y=0
|
||||
target23.height=70
|
||||
target23.name=MyWorld
|
||||
target23.showInterface=false
|
||||
target23.type=ClassTarget
|
||||
target23.width=120
|
||||
target23.x=0
|
||||
target23.y=0
|
||||
target3.height=70
|
||||
target3.name=MovingPlattform
|
||||
target3.name=Groundflower
|
||||
target3.showInterface=false
|
||||
target3.type=ClassTarget
|
||||
target3.width=120
|
||||
target3.x=0
|
||||
target3.y=0
|
||||
target4.height=70
|
||||
target4.name=Ground
|
||||
target4.name=MovingPlattform
|
||||
target4.showInterface=false
|
||||
target4.type=ClassTarget
|
||||
target4.width=120
|
||||
target4.x=0
|
||||
target4.y=0
|
||||
target5.height=70
|
||||
target5.name=UnactiveSpike
|
||||
target5.name=Ground
|
||||
target5.showInterface=false
|
||||
target5.type=ClassTarget
|
||||
target5.width=120
|
||||
target5.x=0
|
||||
target5.y=0
|
||||
target6.height=70
|
||||
target6.name=JumpBoostItem
|
||||
target6.name=UnactiveSpike
|
||||
target6.showInterface=false
|
||||
target6.type=ClassTarget
|
||||
target6.width=120
|
||||
target6.x=0
|
||||
target6.y=0
|
||||
target7.height=70
|
||||
target7.name=BreakingPlattform
|
||||
target7.name=JumpBoostItem
|
||||
target7.showInterface=false
|
||||
target7.type=ClassTarget
|
||||
target7.width=120
|
||||
target7.x=0
|
||||
target7.y=0
|
||||
target8.height=70
|
||||
target8.name=GameOverWorld
|
||||
target8.name=BreakingPlattform
|
||||
target8.showInterface=false
|
||||
target8.type=ClassTarget
|
||||
target8.width=120
|
||||
target8.x=0
|
||||
target8.y=0
|
||||
target9.height=70
|
||||
target9.name=PlayerTestWorld
|
||||
target9.name=GameOverWorld
|
||||
target9.showInterface=false
|
||||
target9.type=ClassTarget
|
||||
target9.width=120
|
||||
target9.x=0
|
||||
target9.y=0
|
||||
version=3.1.0
|
||||
width=1550
|
||||
world.lastInstantiated=MyWorld
|
||||
width=1936
|
||||
world.lastInstantiated=StartWorld
|
||||
xPosition=0
|
||||
yPosition=0
|
||||
|
||||
Reference in New Issue
Block a user