//package BallGame;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;
/**
* <strong>FileName</strong>: Bar.java
* <HR>
* <strong>Description</strong>: Bar object attribute description.
* <P><HR>
* @author
* <em>
* This Game is developed by <B>Fansy</B>.<BR>
* F.S.Studio 1999~2005
* </em>
* @version 0.3.2
*/
public class Bar
{
private BallCanvas canvas; //绘图画布
public Sprite barsp; //挡板精灵
public Bar(BallCanvas c)
{
canvas=c;
}
public Sprite createBarSprite()
{
Image barimage=null; //挡板图像
try{barimage=Image.createImage("/barimage.png");} //装载挡板图像
catch(Exception e){}
barsp=new Sprite(barimage); //建立挡板精灵
barsp.defineReferencePixel(20,0); //修改默认参考点
reset();
return barsp;
}
public void reset()
{
barsp.setPosition(100,260); //设定挡板初始位置
}
public void BarMoveLeft() //移动挡板
{
barsp.move(-2,0);
}
public void BarMoveRight() //移动挡板
{
barsp.move(2,0);
}
public int getBarRefPixelX()
{
return barsp.getRefPixelX();
}
}