package
javagame;
import
org.newdawn.slick.*;
import
org.newdawn.slick.state.*;
public
class
Play extends
BasicGameState
{
Animation mychar,
movingUp,
movingDown,movingLeft,movingRight;
Image worldMap;
boolean
quit =
false;
int[]
duration =
{200,200};
float
mycharPositionX
=0;
float
mycharPositionY
=0;
float
shiftX =
mycharPositionX
+ 320;
float
shiftY =
mycharPositionY
+ 160;
public
Play(int
State)
{
}
public
void
init(GameContainer gc,StateBasedGame sbg) throws
SlickException
{
worldMap
= new
Image("res/world.png");
Image[] walkUp
= {new
Image("res/buckysBack"),new
Image("res/buckysBack")};
Image[]
walkDown = {new
Image("res/buckyFront"),new
Image("res/buckysFront")};
→ 哪個圖像顯示在開始和結束時
Image[]
walkLeft = {new
Image("res/buckysLeft"),new
Image("res/buckysLeft")};
Image[]
walkRight = {new
Image("res/buckysRight"),new
Image("res/buckysRight")};
movingUp
= new
Animation(walkUp,duration,false);
→ 動畫形象和時間
movingDown
= new
Animation(walkDown,duration,false);
movingLeft
= new
Animation(walkLeft,duration,false);
movingRight
= new
Animation(walkRight,duration,false);
mychar
= movingDown;
→ 主角默認是movingDown
}
public
void
render(GameContainer gc,StateBasedGame sbg, Graphics g) throws
SlickException
{
}
public
void
update(GameContainer gc,StateBasedGame sbg, int
delta) throws
SlickException
{
}
public
int
getID()
{
return
1;
}
}
沒有留言:
張貼留言