-
Notifications
You must be signed in to change notification settings - Fork 0
/
Achievements.java
48 lines (40 loc) · 1.24 KB
/
Achievements.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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Achievements here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Achievements extends Button
{
/**
* Act - do whatever the Achievements 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 Achievements() {
super("achievements1.png", "achievements2.png");
start = importSprites("achievements", 2);
}
public void act()
{
MouseInfo mouse = Greenfoot.getMouseInfo();
MainMenu world = (MainMenu)getWorld();
if (mouse != null) {
world.moveHitbox();
if (this.intersects(world.hitbox)) {
setImage(hover);
} else {
setImage(idle);
}
if (Greenfoot.mouseClicked(this)) {
clicked = true;
AudioPlayer.play(100, "tap.mp3", "tap2.mp3");
}
}
}
public void update() {
}
}