Compare commits

...

2 Commits

Author SHA1 Message Date
Caspar 4013820d8d Merge remote-tracking branch 'origin/main'
# Conflicts:
#	SMIMS-Game/project.greenfoot
2026-09-15 20:25:45 +02:00
Caspar 8eeb32af40 SpikedPlattforms1 2026-09-15 20:24:24 +02:00
18 changed files with 149 additions and 133 deletions
Binary file not shown.
+9
View File
@@ -0,0 +1,9 @@
#BlueJ class context
comment0.target=Spike
comment0.text=\r\n\ Write\ a\ description\ of\ class\ Spike\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
comment1.params=pSpeed
comment1.target=Spike(int)
comment2.params=
comment2.target=void\ act()
comment2.text=\r\n\ Act\ -\ do\ whatever\ the\ Spike\ wants\ to\ do.\ This\ method\ is\ called\ whenever\r\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\r\n
numComments=3
+30
View File
@@ -0,0 +1,30 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Spike here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Spike extends Actor
{
int speed;
public Spike(int pSpeed)
{
speed=pSpeed;
}
/**
* Act - do whatever the Spike 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.
this.setLocation(this.getX(), this.getY()+speed);
if(this.isTouching(Player.class))
{
Greenfoot.setWorld(new GameOverWorld());
}
}
}
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
#BlueJ class context
comment0.target=SpikedPlattform
comment0.text=\r\n\ Write\ a\ description\ of\ class\ SpikedPlattform\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n
comment1.params=pSpikeCountdown
comment1.target=void\ act(int)
comment1.text=\r\n\ Act\ -\ do\ whatever\ the\ SpikedPlattform\ 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\ activateSpikes()
comment3.params=
comment3.target=void\ spikeTheSurface()
numComments=4
+61
View File
@@ -0,0 +1,61 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class SpikedPlattform here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class SpikedPlattform extends Plattform
{
int SpikeCountdown;
boolean spikesActivated=false;
boolean isSpiked=false;
Spike[] hasSpikes= new Spike[5];
/**
* 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)
{
// Add your action code here.
if(this.PlayerOnPlattform() && spikesActivated== false)
{
this.activateSpikes();
}
if(spikesActivated)
{
SpikeCountdown--;
}
if(SpikeCountdown==0)
{
this.spikeTheSurface();
}
if(isSpiked && this.PlayerOnPlattform())
{
Greenfoot.setWorld(new GameOverWorld());
}
super.act();
}
public void activateSpikes()
{
spikesActivated=true;
//Sound
//setImage
}
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
//setImage
}
}
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
#BlueJ class context
comment0.target=UnactiveSpike
comment0.text=\r\n\ Write\ a\ description\ of\ class\ UnactiveSpike\ 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\ UnactiveSpike\ wants\ to\ do.\ This\ method\ is\ called\ whenever\r\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\r\n
numComments=2
+19
View File
@@ -0,0 +1,19 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class UnactiveSpike here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class UnactiveSpike extends Actor
{
/**
* Act - do whatever the UnactiveSpike 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.
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 981 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 971 B

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

+12 -133
View File
@@ -1,76 +1,25 @@
#Greenfoot project file
class.Button.image=button-red.png
class.GameOverWorld.image=GameOverBackground.png
class.Ground.image=weave.jpg
class.MyWorld.image=GameBackground.png
class.Player.image=ppl2.png
class.Projectile.image=Projectile1.png
class.StartWorld.image=StartBackground.png
class.TargetingProjectile.image=blue-draught.png
dependency1.from=GameOverWorld
dependency1.to=Button
dependency1.from=PlayerTestWorld
dependency1.to=Ground
dependency1.type=UsesDependency
dependency10.from=MyWorld
dependency10.to=Projectile
dependency10.type=UsesDependency
dependency11.from=Player
dependency11.to=GameOverWorld
dependency11.type=UsesDependency
dependency12.from=Player
dependency12.to=Ground
dependency12.type=UsesDependency
dependency13.from=Player
dependency13.to=Projectile
dependency13.type=UsesDependency
dependency14.from=Plattform
dependency14.to=MyWorld
dependency14.type=UsesDependency
dependency15.from=Plattform
dependency15.to=Player
dependency15.type=UsesDependency
dependency16.from=MovingPlattform
dependency16.to=MyWorld
dependency16.type=UsesDependency
dependency17.from=Button
dependency17.to=MyWorld
dependency17.type=UsesDependency
dependency18.from=PowerUps
dependency18.to=Player
dependency18.type=UsesDependency
dependency19.from=JumpBoostItem
dependency19.to=Player
dependency19.type=UsesDependency
dependency2.from=PlayerTestWorld
dependency2.to=Ground
dependency2.to=Player
dependency2.type=UsesDependency
dependency3.from=PlayerTestWorld
dependency3.from=MyWorld
dependency3.to=Player
dependency3.type=UsesDependency
dependency4.from=PlayerTestWorld
dependency4.to=JumpBoostItem
dependency4.from=Player
dependency4.to=Ground
dependency4.type=UsesDependency
dependency5.from=StartWorld
dependency5.to=Button
dependency5.type=UsesDependency
dependency6.from=MyWorld
dependency6.to=Player
dependency6.type=UsesDependency
dependency7.from=MyWorld
dependency7.to=Plattform
dependency7.type=UsesDependency
dependency8.from=MyWorld
dependency8.to=MovingPlattform
dependency8.type=UsesDependency
dependency9.from=MyWorld
dependency9.to=BreakingPlattform
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=19
package.numTargets=14
package.numDependencies=4
package.numTargets=4
project.charset=UTF-8
publish.hasSource=false
publish.locked=true
@@ -92,99 +41,29 @@ target1.type=ClassTarget
target1.width=120
target1.x=0
target1.y=0
target10.height=70
target10.name=TargetingProjectile
target10.showInterface=false
target10.type=ClassTarget
target10.width=120
target10.x=0
target10.y=0
target11.height=70
target11.name=Projectile
target11.showInterface=false
target11.type=ClassTarget
target11.width=120
target11.x=0
target11.y=0
target12.height=70
target12.name=Button
target12.showInterface=false
target12.type=ClassTarget
target12.width=120
target12.x=0
target12.y=0
target13.height=70
target13.name=PowerUps
target13.showInterface=false
target13.type=ClassTarget
target13.width=120
target13.x=0
target13.y=0
target14.height=70
target14.name=MyWorld
target14.showInterface=false
target14.type=ClassTarget
target14.width=120
target14.x=0
target14.y=0
target2.height=70
target2.name=MovingPlattform
target2.name=Ground
target2.showInterface=false
target2.type=ClassTarget
target2.width=120
target2.x=0
target2.y=0
target3.height=70
target3.name=Ground
target3.name=PlayerTestWorld
target3.showInterface=false
target3.type=ClassTarget
target3.width=120
target3.x=0
target3.y=0
target4.height=70
target4.name=JumpBoostItem
target4.name=MyWorld
target4.showInterface=false
target4.type=ClassTarget
target4.width=120
target4.x=0
target4.y=0
target5.height=70
target5.name=BreakingPlattform
target5.showInterface=false
target5.type=ClassTarget
target5.width=120
target5.x=0
target5.y=0
target6.height=70
target6.name=GameOverWorld
target6.showInterface=false
target6.type=ClassTarget
target6.width=120
target6.x=0
target6.y=0
target7.height=70
target7.name=PlayerTestWorld
target7.showInterface=false
target7.type=ClassTarget
target7.width=120
target7.x=0
target7.y=0
target8.height=70
target8.name=StartWorld
target8.showInterface=false
target8.type=ClassTarget
target8.width=120
target8.x=0
target8.y=0
target9.height=70
target9.name=Plattform
target9.showInterface=false
target9.type=ClassTarget
target9.width=120
target9.x=0
target9.y=0
version=3.1.0
width=1550
world.lastInstantiated=MyWorld
world.lastInstantiated=PlayerTestWorld
xPosition=0
yPosition=0