shot.java

来自「java tutorial all about java game design」· Java 代码 · 共 32 行

JAVA
32
字号
import java.awt.Graphics;
import java.awt.Color;

public class Shot
{
	private int x_pos;
	private int y_pos;

	private final int radius = 3;

	public Shot(int x, int y)
	{
		x_pos = x;
		y_pos = y;
	}

	public int getYPos()
	{
		return y_pos;
	}

	public void moveShot(int speed)
	{
		y_pos += speed;
	}

	public void drawShot(Graphics g)
	{
		g.setColor(Color.yellow);
		g.fillOval(x_pos, y_pos, radius, radius);
	}
}

⌨️ 快捷键说明

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