SpikedPlattforms2

This commit is contained in:
2026-09-16 11:48:19 +02:00
parent 6127510ec8
commit 56b755b3d6
17 changed files with 244 additions and 79 deletions
+13 -7
View File
@@ -12,11 +12,16 @@ public class SpikedPlattform extends Plattform
boolean spikesActivated=false;
boolean isSpiked=false;
Spike[] hasSpikes= new Spike[5];
public SpikedPlattform(int pSpikeCountdown)
{
SpikeCountdown=pSpikeCountdown;
}
/**
* Act - do whatever the SpikedPlattform wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act(int pSpikeCountdown)
public void act()
{
// Add your action code here.
if(this.PlayerOnPlattform() && spikesActivated== false)
@@ -41,6 +46,11 @@ public class SpikedPlattform extends Plattform
public void activateSpikes()
{
spikesActivated=true;
MyWorld theWorld= (MyWorld) this.getWorld();
for(int i=-6; i<7; i++)
{
theWorld.addObject(new UnactiveSpike(2,SpikeCountdown, this ), this.getX()+i* (this.getImage().getWidth()/13), this.getY()-(this.getImage().getHeight()/2));
}
//Sound
//setImage
@@ -49,12 +59,8 @@ public class SpikedPlattform extends Plattform
public void spikeTheSurface()
{
isSpiked=true;
MyWorld theWorld= (MyWorld) this.getWorld();
for(int i=0; i<3; i++)
{
theWorld.addObject(new Spike(2), this.getX()-this.getImage().getWidth()+ i*this.getImage().getWidth()/3, this.getX()-this.getImage().getHeight()/2);
}
//Sound
//Soun)
//setImage
}