-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLife.java
62 lines (57 loc) · 1.66 KB
/
Life.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
62
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Life here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Life extends Actor
{
/**
* Act - do whatever the Life wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
if(Levels.level == 1)
{
if(isTouching(Indra.class))
{
Level1.level1Sound.stop();
Greenfoot.setWorld(new Story2());
Indra.winLevel1 = 0;
Indra.statusMinibos1 = 0;
Indra.musuh = 0;
Levels.level += 1;
Level1.life.add(1);
}
}
if(Levels.level == 2 && Levels.win == 1)
{
if(isTouching(Indra.class))
{
Level2.level2Sound.stop();
Greenfoot.setWorld(new Story3());
Indra.winLevel2 = 0;
Indra.statusMinibos1 = 0;
Indra.musuh = 0;
Levels.level = 3;
Level1.life.add(1);
}
}
if(Levels.win == 2)
{
if(isTouching(Indra.class))
{
Level3.level3Sound.stop();
Greenfoot.setWorld(new WinScreen());
Indra.winLevel2 = 0;
Indra.statusMinibos1 = 0;
Indra.musuh = 0;
Levels.level = 1;
Level1.life.add(1);
}
}
}
}