-
Notifications
You must be signed in to change notification settings - Fork 0
/
RecordsButton.java
40 lines (34 loc) · 1003 Bytes
/
RecordsButton.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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class RecordsButton extends Actor
{
int appeared;
public RecordsButton(){
resize();
appeared = 0;
}
public int appear(){
setImage("RecordsButton.png");
resize();
return 1;
}
/**
* Act - do whatever the ExitButton wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if(appeared == 0){
appeared = appear();
}
if(Greenfoot.mouseClicked(this)){
Greenfoot.playSound("Select.mp3");
Greenfoot.setWorld(new RecordsScreen(getWorld()));
}
}
public void resize(){
GreenfootImage myImage = getImage();
int newHeight = (int)myImage.getHeight()/1+10;
int newWidth = (int)myImage.getWidth()/4-30;
myImage.scale(newHeight, newWidth);
}
}