Fix Health
This commit is contained in:
Binary file not shown.
@@ -15,7 +15,13 @@ public class Groundflower extends PowerUps
|
|||||||
*/
|
*/
|
||||||
public void act()
|
public void act()
|
||||||
{
|
{
|
||||||
bewegeNachUnten();
|
this.touchedByPlayer();
|
||||||
|
this.setLocation(this.getX(), this.getY()+2);
|
||||||
|
if(this.getY()>=this.getWorld().getHeight()-5)
|
||||||
|
{
|
||||||
|
this.getWorld().removeObject(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.touchedByPlayer();
|
this.touchedByPlayer();
|
||||||
// Add your action code here.
|
// Add your action code here.
|
||||||
}
|
}
|
||||||
@@ -29,9 +35,9 @@ public class Groundflower extends PowerUps
|
|||||||
public void bewegeNachUnten()
|
public void bewegeNachUnten()
|
||||||
{
|
{
|
||||||
this.setLocation(this.getX(), this.getY()+2);
|
this.setLocation(this.getX(), this.getY()+2);
|
||||||
if(this.getY()>=this.getWorld().getHeight())
|
if(this.getY()>=this.getWorld().getHeight()-5)
|
||||||
{
|
{
|
||||||
this.getWorld().removeObject(this);
|
this.getWorld().removeObject(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -58,6 +58,8 @@ 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);
|
||||||
|
|
||||||
|
addObject(new TemporaryGround(60*50), 200, 575);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void act()
|
public void act()
|
||||||
@@ -101,6 +103,10 @@ public class MyWorld extends World
|
|||||||
addObject(new SpikedPlattform(100), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform
|
addObject(new SpikedPlattform(100), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Greenfoot.getRandomNumber(100000)>=99750)
|
||||||
|
{
|
||||||
|
addObject(new Groundflower(), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void projectile(){
|
public void projectile(){
|
||||||
|
|||||||
Binary file not shown.
@@ -43,7 +43,7 @@ public class Plattform extends Actor
|
|||||||
Player Spieler= (Player) getOneIntersectingObject(Player.class);
|
Player Spieler= (Player) getOneIntersectingObject(Player.class);
|
||||||
if(this.isTouching(Player.class))
|
if(this.isTouching(Player.class))
|
||||||
{
|
{
|
||||||
if(Spieler.getY()<this.getY()-20)
|
if(Spieler.getY()<this.getY()-39)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -155,7 +155,7 @@ public class Player extends Actor
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
theWorld.addObject((new TemporaryGround(duration)), 200, 550);
|
theWorld.addObject((new TemporaryGround(duration)), 200, 575);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -12,4 +12,6 @@ comment4.params=
|
|||||||
comment4.target=void\ noMoreWarning()
|
comment4.target=void\ noMoreWarning()
|
||||||
comment5.params=pDuration
|
comment5.params=pDuration
|
||||||
comment5.target=void\ RefreshLifeToDuration(int)
|
comment5.target=void\ RefreshLifeToDuration(int)
|
||||||
numComments=6
|
comment6.params=
|
||||||
|
comment6.target=void\ Buffer()
|
||||||
|
numComments=7
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public class TemporaryGround extends Plattform
|
|||||||
public void act()
|
public void act()
|
||||||
{
|
{
|
||||||
// Add your action code here.
|
// Add your action code here.
|
||||||
|
this.Buffer();
|
||||||
Lebensdauer--;
|
Lebensdauer--;
|
||||||
if(Lebensdauer==0)
|
if(Lebensdauer==0)
|
||||||
{
|
{
|
||||||
@@ -56,4 +57,15 @@ public class TemporaryGround extends Plattform
|
|||||||
{
|
{
|
||||||
Lebensdauer=pDuration;
|
Lebensdauer=pDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Buffer()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
Player player= this.getWorld().getObjects(Player.class).get(0);
|
||||||
|
if(this.intersects(player))
|
||||||
|
{
|
||||||
|
player.setLocation(player.getX(), this.getY()-this.getImage().getHeight());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 751 B After Width: | Height: | Size: 750 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=beeper.png
|
class.Groundflower.image=flower2.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,119 +13,128 @@ dependency1.from=PlayerTestWorld
|
|||||||
dependency1.to=Ground
|
dependency1.to=Ground
|
||||||
dependency1.type=UsesDependency
|
dependency1.type=UsesDependency
|
||||||
dependency10.from=MyWorld
|
dependency10.from=MyWorld
|
||||||
dependency10.to=SpikedPlattform
|
dependency10.to=BreakingPlattform
|
||||||
dependency10.type=UsesDependency
|
dependency10.type=UsesDependency
|
||||||
dependency11.from=MyWorld
|
dependency11.from=MyWorld
|
||||||
dependency11.to=Projectile
|
dependency11.to=SpikedPlattform
|
||||||
dependency11.type=UsesDependency
|
dependency11.type=UsesDependency
|
||||||
dependency12.from=MyWorld
|
dependency12.from=MyWorld
|
||||||
dependency12.to=TargetingProjectile
|
dependency12.to=Groundflower
|
||||||
dependency12.type=UsesDependency
|
dependency12.type=UsesDependency
|
||||||
dependency13.from=GameOverWorld
|
dependency13.from=MyWorld
|
||||||
dependency13.to=Button
|
dependency13.to=Projectile
|
||||||
dependency13.type=UsesDependency
|
dependency13.type=UsesDependency
|
||||||
dependency14.from=StartWorld
|
dependency14.from=MyWorld
|
||||||
dependency14.to=Button
|
dependency14.to=TargetingProjectile
|
||||||
dependency14.type=UsesDependency
|
dependency14.type=UsesDependency
|
||||||
dependency15.from=UnactiveSpike
|
dependency15.from=GameOverWorld
|
||||||
dependency15.to=SpikedPlattform
|
dependency15.to=Button
|
||||||
dependency15.type=UsesDependency
|
dependency15.type=UsesDependency
|
||||||
dependency16.from=UnactiveSpike
|
dependency16.from=StartWorld
|
||||||
dependency16.to=MyWorld
|
dependency16.to=Button
|
||||||
dependency16.type=UsesDependency
|
dependency16.type=UsesDependency
|
||||||
dependency17.from=UnactiveSpike
|
dependency17.from=UnactiveSpike
|
||||||
dependency17.to=Spike
|
dependency17.to=SpikedPlattform
|
||||||
dependency17.type=UsesDependency
|
dependency17.type=UsesDependency
|
||||||
dependency18.from=Button
|
dependency18.from=UnactiveSpike
|
||||||
dependency18.to=MyWorld
|
dependency18.to=MyWorld
|
||||||
dependency18.type=UsesDependency
|
dependency18.type=UsesDependency
|
||||||
dependency19.from=PowerUps
|
dependency19.from=UnactiveSpike
|
||||||
dependency19.to=Player
|
dependency19.to=Spike
|
||||||
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=HealthItem
|
dependency20.from=Button
|
||||||
dependency20.to=Player
|
dependency20.to=MyWorld
|
||||||
dependency20.type=UsesDependency
|
dependency20.type=UsesDependency
|
||||||
dependency21.from=JumpBoostItem
|
dependency21.from=PowerUps
|
||||||
dependency21.to=Player
|
dependency21.to=Player
|
||||||
dependency21.type=UsesDependency
|
dependency21.type=UsesDependency
|
||||||
dependency22.from=Groundflower
|
dependency22.from=HealthItem
|
||||||
dependency22.to=Player
|
dependency22.to=Player
|
||||||
dependency22.type=UsesDependency
|
dependency22.type=UsesDependency
|
||||||
dependency23.from=Enemy
|
dependency23.from=JumpBoostItem
|
||||||
dependency23.to=Player
|
dependency23.to=Player
|
||||||
dependency23.type=UsesDependency
|
dependency23.type=UsesDependency
|
||||||
dependency24.from=Enemy
|
dependency24.from=Groundflower
|
||||||
dependency24.to=EnemyProjectile
|
dependency24.to=Player
|
||||||
dependency24.type=UsesDependency
|
dependency24.type=UsesDependency
|
||||||
dependency25.from=Spike
|
dependency25.from=Enemy
|
||||||
dependency25.to=GameOverWorld
|
dependency25.to=Player
|
||||||
dependency25.type=UsesDependency
|
dependency25.type=UsesDependency
|
||||||
dependency26.from=Spike
|
dependency26.from=Enemy
|
||||||
dependency26.to=MyWorld
|
dependency26.to=EnemyProjectile
|
||||||
dependency26.type=UsesDependency
|
dependency26.type=UsesDependency
|
||||||
dependency27.from=Spike
|
dependency27.from=Spike
|
||||||
dependency27.to=Player
|
dependency27.to=GameOverWorld
|
||||||
dependency27.type=UsesDependency
|
dependency27.type=UsesDependency
|
||||||
dependency28.from=Player
|
dependency28.from=Spike
|
||||||
dependency28.to=GameOverWorld
|
dependency28.to=MyWorld
|
||||||
dependency28.type=UsesDependency
|
dependency28.type=UsesDependency
|
||||||
dependency29.from=Player
|
dependency29.from=Spike
|
||||||
dependency29.to=Plattform
|
dependency29.to=Player
|
||||||
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=PlayerProjectile
|
dependency30.to=GameOverWorld
|
||||||
dependency30.type=UsesDependency
|
dependency30.type=UsesDependency
|
||||||
dependency31.from=Player
|
dependency31.from=Player
|
||||||
dependency31.to=TemporaryGround
|
dependency31.to=Plattform
|
||||||
dependency31.type=UsesDependency
|
dependency31.type=UsesDependency
|
||||||
dependency32.from=Player
|
dependency32.from=Player
|
||||||
dependency32.to=Projectile
|
dependency32.to=PlayerProjectile
|
||||||
dependency32.type=UsesDependency
|
dependency32.type=UsesDependency
|
||||||
dependency33.from=Player
|
dependency33.from=Player
|
||||||
dependency33.to=Enemy
|
dependency33.to=TemporaryGround
|
||||||
dependency33.type=UsesDependency
|
dependency33.type=UsesDependency
|
||||||
dependency34.from=Healthbar
|
dependency34.from=Player
|
||||||
dependency34.to=Player
|
dependency34.to=Projectile
|
||||||
dependency34.type=UsesDependency
|
dependency34.type=UsesDependency
|
||||||
dependency35.from=Plattform
|
dependency35.from=Player
|
||||||
dependency35.to=MyWorld
|
dependency35.to=Enemy
|
||||||
dependency35.type=UsesDependency
|
dependency35.type=UsesDependency
|
||||||
dependency36.from=Plattform
|
dependency36.from=Healthbar
|
||||||
dependency36.to=Player
|
dependency36.to=Player
|
||||||
dependency36.type=UsesDependency
|
dependency36.type=UsesDependency
|
||||||
dependency37.from=MovingPlattform
|
dependency37.from=Plattform
|
||||||
dependency37.to=MyWorld
|
dependency37.to=MyWorld
|
||||||
dependency37.type=UsesDependency
|
dependency37.type=UsesDependency
|
||||||
dependency38.from=MovingPlattform
|
dependency38.from=Plattform
|
||||||
dependency38.to=Player
|
dependency38.to=Player
|
||||||
dependency38.type=UsesDependency
|
dependency38.type=UsesDependency
|
||||||
dependency39.from=SpikedPlattform
|
dependency39.from=MovingPlattform
|
||||||
dependency39.to=Spike
|
dependency39.to=MyWorld
|
||||||
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=SpikedPlattform
|
dependency40.from=MovingPlattform
|
||||||
dependency40.to=GameOverWorld
|
dependency40.to=Player
|
||||||
dependency40.type=UsesDependency
|
dependency40.type=UsesDependency
|
||||||
dependency41.from=SpikedPlattform
|
dependency41.from=TemporaryGround
|
||||||
dependency41.to=MyWorld
|
dependency41.to=Player
|
||||||
dependency41.type=UsesDependency
|
dependency41.type=UsesDependency
|
||||||
dependency42.from=SpikedPlattform
|
dependency42.from=SpikedPlattform
|
||||||
dependency42.to=UnactiveSpike
|
dependency42.to=Spike
|
||||||
dependency42.type=UsesDependency
|
dependency42.type=UsesDependency
|
||||||
dependency43.from=TargetingProjectile
|
dependency43.from=SpikedPlattform
|
||||||
dependency43.to=Player
|
dependency43.to=GameOverWorld
|
||||||
dependency43.type=UsesDependency
|
dependency43.type=UsesDependency
|
||||||
dependency44.from=PlayerProjectile
|
dependency44.from=SpikedPlattform
|
||||||
dependency44.to=Enemy
|
dependency44.to=MyWorld
|
||||||
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
|
||||||
@@ -136,17 +145,17 @@ dependency7.from=MyWorld
|
|||||||
dependency7.to=Healthbar
|
dependency7.to=Healthbar
|
||||||
dependency7.type=UsesDependency
|
dependency7.type=UsesDependency
|
||||||
dependency8.from=MyWorld
|
dependency8.from=MyWorld
|
||||||
dependency8.to=MovingPlattform
|
dependency8.to=TemporaryGround
|
||||||
dependency8.type=UsesDependency
|
dependency8.type=UsesDependency
|
||||||
dependency9.from=MyWorld
|
dependency9.from=MyWorld
|
||||||
dependency9.to=BreakingPlattform
|
dependency9.to=MovingPlattform
|
||||||
dependency9.type=UsesDependency
|
dependency9.type=UsesDependency
|
||||||
editor.fx.0.height=739
|
editor.fx.0.height=1048
|
||||||
editor.fx.0.width=816
|
editor.fx.0.width=1936
|
||||||
editor.fx.0.x=552
|
editor.fx.0.x=-8
|
||||||
editor.fx.0.y=98
|
editor.fx.0.y=-8
|
||||||
height=1048
|
height=1048
|
||||||
package.numDependencies=44
|
package.numDependencies=47
|
||||||
package.numTargets=25
|
package.numTargets=25
|
||||||
project.charset=UTF-8
|
project.charset=UTF-8
|
||||||
publish.hasSource=false
|
publish.hasSource=false
|
||||||
|
|||||||
Reference in New Issue
Block a user