⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 animchar.java

📁 j2me 的小游戏
💻 JAVA
字号:
/*
 * AnimChar.java
 *
 * Copyright 1999 JJKING Software, Junichi Ito <jun1@mailhost.net>
 * Permission to use, copy, modify, and distribute this software and its
 * documentation without fee for NON-COMMERCIAL is free.
 */

import com.sun.kjava.Graphics;

/**
 * This is the super-class for a stateful animation character to
 * be managed AnimManager. The sub-class has responsible for managing state
 * of character
 *
 * @version 1.0  1999/10/2
 */
public abstract class AnimChar
{
	/**
	 * The state of character which means manager need not the character
	 * that has this state. The manager removes the character from the list
	 * of managed ones.
	 */
	public static final int STATE_HIDE = 0;

	/**
	 * The reference to manager to get information.
	 */
	protected AnimManager mgr;
	
	/**
	 * The state of the character.
	 * If the character has this state, the manager remove it from list and stop to manage.
	 */
	protected int state = STATE_HIDE;
	
	/**
	 * This method is invoked when manager starts to manage this character.
	 * The subclass can set initial state by overriding this method.  
	 * @param mgr the animation manager.
	 */
	public void start(AnimManager mgr)
	{
		this.mgr = mgr;
	}
	
	/**
	 * Sets the state.
	 * @param the state of character.
	 */
	public void setState(int state)
	{
		this.state = state;
	}
	
	/**
	 * Returns the state.
	 */
	public int getState()
	{
		return state;
	}
	
	/**
	 * Move the character.
	 */
	public abstract void move();
	
	/**
	 * Draw the character on the given graphics.
	 * @param g the graphics.
	 */
	public abstract void paint(Graphics g);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -