📄 sickevent.java
字号:
/*
* SickEvent.java
*
* Created on 2006年5月5日, 上午11:48
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package DogPet;
import java.util.Timer;
import java.util.TimerTask;
import javax.microedition.lcdui.*;
// Referenced classes of package com.webineti:
// GameData, GameView
public class SickEvent
{
class Task14 extends TimerTask
{
public final void run()
{
if(GameView.events == -1)
{
swapped = swapped + 1;
if(swapped > sick.length - 1)
swapped = 0;
view.repaint();
}
}
Task14()
{
}
}
public void add_data()
{
GameData.Intelligence += 5;
if(GameData.Intelligence > 100)
GameData.Intelligence = 100;
GameData.Capacity--;
if(GameData.Capacity < 0)
GameData.Capacity = 0;
}
public SickEvent(GameView view)
{
swapped = 0;
repeat = 0;
start_x = 0;
start_y = 0;
image_bg = null;
timer = new Timer();
flashDuration = 1000;
sick = new Image[2];
this.view = view;
try
{
sick[0] = Image.createImage("/sick/dog_sick1.png");
sick[1] = Image.createImage("/sick/dog_sick2.png");
}
catch(Exception ex) { }
timer.scheduleAtFixedRate(new Task14(), 0L, flashDuration);
}
public void paint(Graphics g)
{
this.g = g;
if(sick[swapped] != null)
{
view.g_cls(g, 0);
g.drawImage(sick[0], GameData.start_x + 17, GameData.start_y + 54, 20);
switch(swapped)
{
case 1: // '\001'
g.drawImage(sick[swapped], GameData.start_x + 17 + 18, GameData.start_y + 54 + 6, 20);
break;
}
}
}
public void killed()
{
timer.cancel();
timer = null;
}
GameView view;
private Graphics g;
int swapped;
private int repeat;
private int start_x;
private int start_y;
private Image image_bg;
private Timer timer;
private int flashDuration;
Image sick[];
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -