Re: moving a token from a board(JPG)
- From: "Claus Petersen" <claus$E30@xxxxxxxxxxxxxxx>
- Date: Mon, 9 May 2005 14:36:32 +0200
You don't give us much to go from but I guess that you are talking about a
grid game like chess.
So start by creating an object, call it Player, in that object have an int
named collumn and an int called row.
that represents the position (each field in the grid has a width and a
height) so if the Player is located in row 5 and column 5 you place the Jpg
in x = fieldWidth * collumn, y = fieldHeight * row. Remember that if the
grids position is different from top left corner of the screen you also have
to add the offset...
from there its pretty strait forward to implement keypress that update the
object's row and collumn.
fx. in the keyEventHandler
if(KEY.A)
{
player.moveLeft();
}
if(KEY.Z)
{
player.moveDown();
}
If you need more exact code then reply to the group.
Regards
Claus
"joenchinghkg" <qooboy0109@xxxxxxxxxxx> skrev i en meddelelse
news:1115624209.562080.99560@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> I am going to write a game. The players at the game can walk on the
> board depends on shuffling the dice (from 1 - 6). I have already coded
> the board already, however, I feel confuse how I can interact with the
> player to the board.
> For example, If player A gets 5, he can move for 5 blocks.
> I feel confuse how I should code for setting the players on the board,
> since I just put a jpg on my code and shows the board when I run it.
>
>
>
>
> Thanks
>
.
- References:
- moving a token from a board(JPG)
- From: joenchinghkg
- moving a token from a board(JPG)
- Prev by Date: Re: Help needed building 3D modelling/mapping application
- Next by Date: Push data to mobile phones
- Previous by thread: moving a token from a board(JPG)
- Next by thread: Re: moving a token from a board(JPG)
- Index(es):
Relevant Pages
|