daily pastebin goal
66%
SHARE
TWEET

Untitled

a guest May 17th, 2018 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
  2.  
  3. /**
  4.  * Write a description of class BlueDot here.
  5.  *
  6.  * @author (your name)
  7.  * @version (a version number or a date)
  8.  */
  9. public class BlueDot extends Enemy
  10. {
  11.     int minX = 230;  
  12.     int maxX = 370;
  13.     int speed = Greenfoot.getRandomNumber(5)+1;  //so schnell bewegt sich ein BlueDot pro Runde
  14.     /**
  15.      * Act - do whatever the BlueDot wants to do. This method is called whenever
  16.      * the 'Act' or 'Run' button gets pressed in the environment.
  17.      */
  18.     public void act()
  19.     {
  20.         if(getX()>maxX || getX()<minX){  //wenn min oder max X-Position erreicht
  21.             speed = -speed; //bewegungsrichtung umkehren
  22.         }
  23.         move(speed);  //bewegen    
  24.     }    
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top