📄 enemy.java
字号:
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date: 2005-4-9 12:51:46
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: Enemy.java
package girl60;
import com.nokia.mid.ui.DirectGraphics;
import com.nokia.mid.ui.DirectUtils;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
// Referenced classes of package AfterDark:
// Human, Rectangle, MovingObject, GameManager
public class Enemy extends Human
{
public Enemy(int objType, int locX, int locY, int width, int height)
{
super(objType, locX, locY, width, height);
super.speedX = 2;
super.speedY = 2;
}
public void Initial(String name, int objType, String imgURL, int maxHP, int actImgWidth)
{
try
{
if(eImg == null)
eImg = Image.createImage(imgURL);
}
catch(Exception ioe)
{
return;
}
Initial(name, objType, maxHP, super.curLoc.GetX(), super.curLoc.GetY());
}
public void Initial(String name, int objType, int maxHP, int posX, int posY)
{
super.name = name;
SetType(objType);
super.legArea = new Rectangle(super.curLoc);
int actImgWidth = 24;
super.curLoc.SetWidth(actImgWidth);
super.curLoc.SetHeight(24);
switch(objType)
{
case 2: // '\002'
case 3: // '\003'
case 4: // '\004'
case 7: // '\007'
case 8: // '\b'
case 9: // '\t'
case 10: // '\n'
case 11: // '\013'
case 12: // '\f'
case 13: // '\r'
case 14: // '\016'
case 15: // '\017'
case 16: // '\020'
case 17: // '\021'
case 18: // '\022'
case 19: // '\023'
case 20: // '\024'
case 21: // '\025'
case 22: // '\026'
default:
super.attPower = 8;
break;
case 0: // '\0'
super.attPower = 4;
break;
case 1: // '\001'
super.attPower = 5;
break;
case 5: // '\005'
super.attPower = 10;
break;
case 6: // '\006'
super.curLoc.SetWidth(15);
super.curLoc.SetHeight(27);
super.legArea.SetBounds(super.curLoc.GetX(), super.curLoc.GetY(), 15, 27);
break;
case 23: // '\027'
super.attPower = 15;
super.curLoc.SetWidth(29);
super.curLoc.SetHeight(38);
super.legArea.SetBounds(super.curLoc.GetX(), super.curLoc.GetY(), 29, 33);
break;
case 24: // '\030'
super.attPower = 20;
super.curLoc.SetWidth(58);
super.curLoc.SetHeight(55);
super.legArea.SetBounds(super.curLoc.GetX() + 13, super.curLoc.GetY() + 7, 32, 32);
break;
case 25: // '\031'
super.attPower = 15;
super.curLoc.SetWidth(16);
super.curLoc.SetHeight(14);
super.legArea.SetBounds(super.curLoc.GetX(), super.curLoc.GetY(), 16, 16);
break;
case 26: // '\032'
super.attPower = 15;
super.curLoc.SetWidth(16);
super.curLoc.SetHeight(14);
super.legArea.SetBounds(super.curLoc.GetX(), super.curLoc.GetY(), 16, 16);
break;
}
SetHP(maxHP);
SetMaxHP(maxHP);
super.actionImgWidth = super.curLoc.GetWidth();
super.bodyOffsetX = (super.curLoc.GetWidth() - super.legArea.GetWidth()) / 2;
SetDirection(1);
SetAction(0);
SetLocation(posX, posY);
}
public void SetLocation(int locX, int locY)
{
int disX = super.curLoc.GetWidth() - super.legArea.GetWidth();
int disY = super.curLoc.GetHeight() - super.legArea.GetHeight();
super.curLoc.SetLocation(locX, locY);
super.curPosY = super.curLoc.GetY() + super.curLoc.GetHeight();
super.legArea.SetLocation(super.curLoc.GetX() + disX, super.curLoc.GetY() + disY);
}
public void Run(int pLocX, int pLocY)
{
if(GetHP() <= 0 && GetAction() != 7)
{
SetAction(7);
} else
{
if(IsDead())
return;
if(GetHP() >= 0)
SelectAction(pLocX, pLocY);
}
super.isMoving = false;
switch(super.actionId)
{
case 0: // '\0'
case 4: // '\004'
case 5: // '\005'
default:
break;
case 1: // '\001'
{
if(--super.dalayAction <= 0)
if(++super.actionScript > super.actionScriptLength)
{
ChangeAction(0);
} else
{
if(super.actionScript == 2)
super.drawImgId = 2;
else
super.drawImgId = 0;
super.dalayAction = 3;
}
int temp1 = MoveToDirection(super.speedX, false);
UpdateCanMove(super.speedX, temp1);
break;
}
case 2: // '\002'
{
if(--super.dalayAction <= 0)
if(++super.actionScript > super.actionScriptLength)
{
ChangeAction(0);
} else
{
if(super.actionScript == 2)
super.drawImgId = 2;
else
super.drawImgId = 0;
super.dalayAction = 2;
}
int temp1 = MoveToDirection(super.speedX + 1, false);
UpdateCanMove(super.speedX + 1, temp1);
break;
}
case 3: // '\003'
{
if(--super.dalayAction > 0)
break;
if(++super.actionScript > super.actionScriptLength)
{
ChangeAction(0);
} else
{
super.drawImgId++;
super.dalayAction = 6;
}
break;
}
case 6: // '\006'
{
if(--super.dalayAction <= 0)
{
if(++super.actionScript > super.actionScriptLength)
{
ChangeAction(0);
} else
{
super.drawImgId = 3;
super.dalayAction = 3;
}
break;
}
if(super.actionScript <= 0 && GetType() != 24)
{
int moveDis = 2 + super.dalayAction * 3;
int temp1 = MoveToDirection(moveDis, false);
UpdateCanMove(moveDis, temp1);
}
break;
}
case 7: // '\007'
{
if(--super.dalayAction <= 0)
{
if(++super.actionScript > super.actionScriptLength)
{
super.destroy = true;
break;
}
if(super.actionScript > 1)
{
super.drawImgId = 3;
super.dalayAction = 6;
} else
{
super.drawImgId = 3;
super.dalayAction = 3;
}
break;
}
if(super.actionScript <= 0)
super.moveDis = MoveToDirection(2 + super.dalayAction * 3, false);
break;
}
}
}
public void SetAction(int newAct)
{
super.actionId = newAct;
super.actionScript = 0;
switch(newAct)
{
case 0: // '\0'
super.actionScriptLength = 0;
super.dalayAction = 0;
super.drawImgId = 0;
break;
case 1: // '\001'
super.actionScriptLength = 3;
super.dalayAction = 3;
super.drawImgId = 1;
break;
case 2: // '\002'
super.actionScriptLength = 2;
super.dalayAction = 2;
super.drawImgId = 1;
break;
case 3: // '\003'
super.actionScriptLength = 1;
super.dalayAction = 6;
super.drawImgId = 2;
break;
case 6: // '\006'
super.stage = 0;
super.explosionStage = 0;
super.actionScriptLength = 2;
super.dalayAction = 5;
super.drawImgId = 0;
break;
case 7: // '\007'
super.stage = 0;
super.explosionStage = 0;
super.actionScriptLength = 2;
super.dalayAction = 5;
super.drawImgId = 0;
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -