📄 friendplane.java
字号:
package com.lovo.sprite.plane;
import java.awt.Image;
/**
* <p>玩家飞机类</p>
* @author 袁渝波
* @version 1.00 2006/9/25 袁渝波
* <p> 1.03 2006/09/25 袁渝波 优化代码,优化注释</p>
* @see PlaneSprite
*
*/
public class FriendPlane extends PlaneSprite
{
/**
* 构造器,初始化参数
* @param planeImage 图象对象 玩家飞机的图片
*/
public FriendPlane(Image planeImage)
{
super(planeImage);
this.setStep(10, 10);
this.setPlaneLife(10);
this.setPlaneType(5);
this.setLocation(255, 250);
}
/**
* 计算玩家飞机运行路线
*/
public void updateState()
{
/**
* 玩家飞机生命值大于0则显示玩家飞机
*/
if (this.planeLife > 0)
{
this.setVisible(true);
}
if (this.planeLife > 10)
{
/**
* 生命最大值为10
*/
this.setPlaneLife(10);
}
/**
* 玩家飞机X坐标小于0则设置玩家飞机X坐标为0,Y坐标不变
*/
if (this.getX() <= 0)
{
this.setLocation(0, this.getY());
}
/**
* 玩家飞机X坐标大于450则设置玩家飞机X坐标为450,Y坐标不变
*/
if (this.getX() >= 450)
{
this.setLocation(450, this.getY());
}
/**
* 玩家飞机Y坐标小于0则设置玩家飞机T坐标为0,X坐标不变
*/
if (this.getY() <= 0)
{
this.setLocation(this.getX(), 0);
}
/**
* 玩家飞机Y坐标大于670则设置玩家飞机T坐标为670,X坐标不变
*/
if (this.getY() >= 670)
{
this.setLocation(this.getX(), 670);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -