package code.kalter.longflight.game; import javax.microedition.lcdui.Graphics; /** * Цветовой эффект при попадании пули в игрока * * @author KalterFive */ public class ColorEffect { private final int screenW; private final int screenH; private final int color; //========================== private final int number; // количество кадров для рисования цветного экрана private int count; // счётчик //========================== private boolean is; public ColorEffect(int color, int number, int screenW, int screenH) { this.color = color; this.number = number; this.screenW = screenW; this.screenH = screenH; } public void activate() { is = true; count = 0; } public void paint(Graphics graphics) { if (is) { graphics.setColor(color); graphics.fillRect(0, 0, screenW, screenH); is = ++count < number; } } }