-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSmoke.java
More file actions
executable file
·66 lines (54 loc) · 1.33 KB
/
Copy pathSmoke.java
File metadata and controls
executable file
·66 lines (54 loc) · 1.33 KB
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
56
57
58
59
60
61
62
63
64
65
66
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.image.*;
import java.awt.Image;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.lang.Math;
/**
* Write a description of class Smoke here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Smoke extends Actor
{
static GreenfootImage image[];
public static int spawnIdx = -1;
int index=0;
int coloridx = 0;
static
{
image = new GreenfootImage[9];
image [0] = new GreenfootImage("smoke0.png");
int rad = 19;
for(int i = 1 ; i < 9 ; i++)
{
rad -= 2;
BufferedImage master = image[0].getAwtImage();
image[i] = new GreenfootImage(rad,rad);
BufferedImage bi = image[i].getAwtImage();
Graphics2D g = (Graphics2D)bi.getGraphics();
g.drawImage(master,0,0,rad,rad,null);
}
}
public Smoke()
{
setImage(image[index]);
}
int idxcounter = 0;
public void act()
{
if(index > 8)
{
getWorld().removeObject(this);
return;
}
setImage(image[index]);
idxcounter++;
if(idxcounter > 3)
{
index++;
idxcounter = 0;
}
}
}