DEADSOFTWARE

Initial commit.
[LongFlight.git] / src / code / kalter / longflight / game / ColorEffect.java
1 package code.kalter.longflight.game;
3 import javax.microedition.lcdui.Graphics;
5 /**
6 * Цветовой эффект при попадании пули в игрока
7 *
8 * @author KalterFive
9 */
10 public class ColorEffect {
12 private final int screenW;
13 private final int screenH;
15 private final int color;
16 //==========================
17 private final int number; // количество кадров для рисования цветного экрана
18 private int count; // счётчик
19 //==========================
20 private boolean is;
22 public ColorEffect(int color, int number, int screenW, int screenH) {
23 this.color = color;
24 this.number = number;
25 this.screenW = screenW;
26 this.screenH = screenH;
27 }
29 public void activate() {
30 is = true;
31 count = 0;
32 }
34 public void paint(Graphics graphics) {
35 if (is) {
36 graphics.setColor(color);
37 graphics.fillRect(0, 0, screenW, screenH);
38 is = ++count < number;
39 }
40 }
41 }