-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForestryAndConservation.java
More file actions
executable file
·52 lines (48 loc) · 1.5 KB
/
ForestryAndConservation.java
File metadata and controls
executable file
·52 lines (48 loc) · 1.5 KB
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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* ForestryAndConservation class
*
* @author (your name)
* @version (a version number or a date)
*/
public class ForestryAndConservation extends Industry {
private int SI = +3;
private int EPR = +1;
private int CWI = +2;
private int type = 4;
/** Constructor for ForestryAndConservation */
public ForestryAndConservation() {
super(+3, +1, +2, 4);
L1 = new GreenfootImage("images/industry/Forestry1.png");
L2 = new GreenfootImage("images/industry/Forestry2.png");
L3 = new GreenfootImage("images/industry/Forestry3.png");
}
/**
* Act - do whatever the ForestryAndConservation wants to do. This method is called whenever the
* 'Act' or 'Run' button gets pressed in the environment.
*/
public void act() {
checkNextLevel();
checkImage();
}
/** Checks if it can level up based on the criteria */
public void checkNextLevel() {
if (MainWorld.getTotalCoin() >= 1000 && level == 0) {
levelUp();
MainWorld.changeTotalCoin(-1000);
MainWorld.changeCWI(2);
MainWorld.changeSI(1);
} else if (MainWorld.getTotalCoin() >= 1500 && level == 1) {
levelUp();
MainWorld.changeTotalCoin(-1500);
MainWorld.changeCWI(1);
MainWorld.changeSI(1);
} else if (MainWorld.getTotalCoin() >= 750
&& level == 2
&& MainWorld.getIndustryLevel(3) >= 2) {
levelUp();
MainWorld.changeTotalCoin(-750);
MainWorld.changeSI(1);
}
}
}