-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUrbanDevelopment.java
More file actions
executable file
·52 lines (48 loc) · 1.48 KB
/
UrbanDevelopment.java
File metadata and controls
executable file
·52 lines (48 loc) · 1.48 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)
/**
* UrbanDevelopment Class
*
* @author Jimmy, Adrian, Daniel
* @version April 24, 2024
*/
public class UrbanDevelopment extends Industry {
private int SI = -2;
private int EPR = +2;
private int CWI = +1;
private int type = 8;
/** Constructor for UrbanDevelopment */
public UrbanDevelopment() {
super(-2, +2, +1, 8);
L1 = new GreenfootImage("images/industry/UrbanDev1.png");
L2 = new GreenfootImage("images/industry/UrbanDev2.png");
L3 = new GreenfootImage("images/industry/UrbanDev3.png");
}
/**
* Act - do whatever the UrbanDevelopment 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() >= 1700 && level == 0) {
levelUp();
MainWorld.changeTotalCoin(-1700);
MainWorld.changeSI(1);
} else if (MainWorld.getTotalCoin() >= 2550 && level == 1) {
levelUp();
MainWorld.changeTotalCoin(-2550);
MainWorld.changeSI(2);
} else if (MainWorld.getTotalCoin() >= 1275
&& level == 2
&& MainWorld.getIndustryLevel(4) >= 2
&& MainWorld.getIndustryLevel(3) >= 2) {
levelUp();
MainWorld.changeTotalCoin(-1275);
MainWorld.changeSI(1);
MainWorld.changeCWI(1);
}
}
}