Projektil und Game Over Transition bei Kollision
This commit is contained in:
+13
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user