-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLevelBoss.java
More file actions
59 lines (51 loc) · 1.47 KB
/
LevelBoss.java
File metadata and controls
59 lines (51 loc) · 1.47 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
53
54
55
56
57
58
59
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class LevelBoss here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class LevelBoss extends ScrollingWorld
{
/**
* Constructor for objects of class LevelBoss.
*
*/
Mobby mobby;
PowerBar powerBar;
HealthBar healthBar;
public double power;
public boolean resetPower;
private GreenfootSound bkgMusic;
public LevelBoss()
{
super("bosslvl.png", 16833);
mobby = new Mobby();
powerBar = new PowerBar();
healthBar = new HealthBar();
bkgMusic = new GreenfootSound("BossLevel.mp3");
shiftWorld(0);
prepare();
bkgMusic.playLoop();
}
public void prepare()
{
addObject(mobby, 250, getHeight() - 240/2 - 50);
addObject(powerBar, getWidth() / 2, 200);
addObject(healthBar, getWidth() / 2, 100);
Chandelier ch = new Chandelier();
addObject(ch, 7300, 100);
Boss b = new Boss();
addObject(b, 7300, getHeight() - 240/2 - 50);
}
public void act()
{
healthBar.setLocation(mobby.getX(), mobby.getY() - 175);
powerBar.setLocation(mobby.getX(), mobby.getY() - 150);
if (xOffset <= -15228) {
IntroScreen introScreen = new IntroScreen();
Greenfoot.setWorld(introScreen);
bkgMusic.stop();
}
}
}