-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathTimer1.java
34 lines (28 loc) · 840 Bytes
/
Timer1.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
import java.util.Timer;
import java.util.TimerTask;
import greenfoot.*;
/**
* Write a description of class Timer1 here.
*
* @author (your name)
* @version (a version number or a date)
*/
class Timer1 extends TimerTask
{
public GreenfootImage[] image;
public String spriteSheet;
public int frame;
public int frame2;
Timer1(GreenfootImage[] image, String filename, int frame, int frame2) {
this.image = image;
this.spriteSheet = filename;
this.frame = frame;
this.frame2 = frame2;
}
public void run() {
GreenfootImage first = new GreenfootImage(spriteSheet+(frame+1)+".png");
GreenfootImage second = new GreenfootImage(spriteSheet+(frame2+1)+".png");
image[frame] = first;
image[frame2] = second;
}
}