Projektil und Game Over Transition bei Kollision
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
|
||||
|
||||
/**
|
||||
* Write a description of class Projectile here.
|
||||
*
|
||||
* @author (your name)
|
||||
* @version (a version number or a date)
|
||||
*/
|
||||
public class Projectile extends Actor
|
||||
{
|
||||
/**
|
||||
* Act - do whatever the Projectile wants to do. This method is called whenever
|
||||
* the 'Act' or 'Run' button gets pressed in the environment.
|
||||
*/
|
||||
public void act()
|
||||
{
|
||||
falling();
|
||||
}
|
||||
|
||||
public void falling(){
|
||||
setLocation(getX(), getY() + 5);
|
||||
if(getY() > getWorld().getHeight() -5){
|
||||
getWorld().removeObject(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user