Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import greenfoot.*;
- public class CFood extends CInterFish
- {
- public CFood(int size)
- {
- super(size);
- this.getImage().scale(25, 10);
- this.getImage().mirrorHorizontally();
- }
- public void act()
- {
- MoveAround();
- }
- public void MoveAround()
- {
- this.move(1);
- if (this.isAtEdge()) //ak sa dotyka steny
- {
- this.getWorld().removeObject(this); //zmizme
- }
- }
- public void InteractWithFish(CFish fish)
- {
- fish.Eat(this);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement