-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeepSummon.java
More file actions
31 lines (29 loc) · 973 Bytes
/
DeepSummon.java
File metadata and controls
31 lines (29 loc) · 973 Bytes
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
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class DeepSummon here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class DeepSummon extends Summons
{
private SimpleTimer timer = new SimpleTimer();
GreenfootSound sound = new GreenfootSound("noHit.wav");
/**
* Act - do whatever the DeepSummon wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
animate();
move(2);
}
private void animate(){
sound.play();
if(timer.millisElapsed()>0)setImage("deepSummon1.png");
if(timer.millisElapsed()>100)setImage("deepSummon2.png");
if(timer.millisElapsed()>200)setImage("deepSummon3.png");
if(timer.millisElapsed()>300)setImage("deepSummon4.png");
if(timer.millisElapsed()>400)timer.mark();
}
}