-
Notifications
You must be signed in to change notification settings - Fork 0
/
Space.java
61 lines (59 loc) · 1.45 KB
/
Space.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.io.*;
/**
* Write a description of class Space here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Space extends AllObject
{
/**
* Act - do whatever the Space wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public Space()
{
scaleDownImage(2,2);
}
public void act()
{
rr();
}
public void rr()
{
if(isTouching(OneRedBall.class))
{
removeTouching(OneRedBall.class);
}
if(isTouching(TwoRedBall.class))
{
removeTouching(TwoRedBall.class);
}
if(isTouching(ThreeRedBall.class))
{
removeTouching(ThreeRedBall.class);
}
if(isTouching(OneBlueBall.class))
{
removeTouching(OneBlueBall.class);
}
if(isTouching(TwoBlueBall.class))
{
removeTouching(TwoBlueBall.class);
}
if(isTouching(ThreeBlueBall.class))
{
removeTouching(ThreeBlueBall.class);
}
if(isTouching(Player1.class))
{
removeTouching(Player1.class);
}
if(isTouching(Player2.class))
{
removeTouching(Player2.class);
}
this.getWorld().removeObject(this);
}
}