Projektil und Game Over Transition bei Kollision

This commit is contained in:
2026-09-15 10:21:16 +02:00
parent ec0e80fe97
commit 07c5614d44
16 changed files with 126 additions and 12 deletions
+13 -1
View File
@@ -8,7 +8,8 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
*/
public class MyWorld extends World
{
int timer = 200;
/**
* Constructor for objects of class MyWorld.
*
@@ -28,4 +29,15 @@ public class MyWorld extends World
Player player = new Player();
addObject(player,302,320);
}
public void act(){
if(timer > 0){
timer = timer - 1;
}
else{
Projectile projectile = new Projectile();
addObject(projectile,Greenfoot.getRandomNumber(300)+50,0);
timer = 200;
}
}
}