-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLevel3.java
49 lines (41 loc) · 1.36 KB
/
Level3.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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class Level3 extends MyWorld
{
private int level2Counter;
private int x1;
private int x2;
private int x3;
//privat
Diamond diamond = new Diamond();
Diamond1 diamond1 = new Diamond1();
Boo boo = new Boo();
//Boo boo1 = new Boo();
//Boo boo2 = new Boo();
//Bomb bomb = new Bomb();
public Level3()
{
level2Counter=1;
}
public void act()
{
super.act();
if( level2Counter%400==0 )
addObject(boo,x3=30+Greenfoot.getRandomNumber(900),20);
if(level2Counter%500==0)
addObject(diamond,x1=30+Greenfoot.getRandomNumber(900),20);
if(level2Counter%1900==0)
addObject(diamond,x2=30+Greenfoot.getRandomNumber(900),20);
if( !(getObjectsAt(x3,581,Boo.class).isEmpty()) )
removeObject( getObjects(Boo.class).get(0) );
if( !(getObjectsAt(x1,581,Diamond.class).isEmpty()) )
removeObject( getObjects(Diamond.class).get(0) );
if( !(getObjectsAt(x2,581,Diamond1.class).isEmpty()) )
removeObject( getObjects(Diamond1.class).get(0) );
level2Counter++;
}
//@override
public void nextLevel()
{
Greenfoot.setWorld(new Level4());
}
}