-
Notifications
You must be signed in to change notification settings - Fork 0
/
Logo.java
55 lines (46 loc) · 1.19 KB
/
Logo.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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Logo here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Logo extends Actor
{
int lightsIn;
public Logo(){
resize();
lightsIn = 0;
}
/**
* Act - do whatever the Logo wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if(lightsIn == 0){
lightsIn = turnOn();
}
}
public int turnOn(){
int turn=1;
Greenfoot.playSound("Neon Logo.mp3");
try
{
Thread.sleep(500);
}
catch(InterruptedException ex)
{
Thread.currentThread().interrupt();
}
setImage("1585603796585.png");
resize();
return turn;
}
public void resize(){
GreenfootImage myImage = getImage();
int newHeight = (int)myImage.getHeight()*5/3+70;
int newWidth = (int)myImage.getWidth()/2;
myImage.scale(newHeight, newWidth);
}
}