-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathStart.java
57 lines (52 loc) · 1.69 KB
/
Start.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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Start here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Start extends Button
{
/**
* Act - do whatever the Start wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public boolean clicked = false;
GreenfootImage[] start;
public int counter = 0;
public Start() {
super("start1.png", "start2.png");
start = importSprites("start", 2);
}
public void act()
{
MouseInfo mouse = Greenfoot.getMouseInfo();
MainMenu world = (MainMenu)getWorld();
if (clicked) {
animate(start, 80, true);
counter++;
if (counter == 200) {
update();
}
} else {
if (mouse != null) {
world.moveHitbox();
if (this.intersects(world.hitbox)) {
setImage(hover);
} else {
setImage(idle);
}
if (Greenfoot.mouseClicked(this)) {
clicked = true;
world.menutheme.stop();
AudioPlayer.play(100, "gravebutton.mp3");
AudioPlayer.play(70, "losemusic.mp3");
getWorld().addObject(new DelayAudio(new GreenfootSound("evillaugh.mp3"), 70, false, 1000L), 0,0);
}
}
}
}
public void update() {
getWorld().addObject(new Transition(false, new Intro(), 4), 365, 215);
}
}