Re: moving a token from a board(JPG)



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
>


.



Relevant Pages

  • Grid-Game: Guessing # Of Uncoprime Walls
    ... Game is for 2 or more players. ... Start with an n-by-n grid drawn lightly on paper. ... player 1 places the odd integers in the grid, ... The player whose guess is closest to the actual number of walls ...
    (rec.puzzles)
  • Game Of Differences
    ... Here is a simple game played, as many of my games, ... with an n-by-n grid drawn on paper. ... First the player puts a 1 in any of the grid's ... squares next to the last integer written in the ...
    (sci.math)
  • Game Of Differences
    ... Here is a simple game played, as many of my games, ... with an n-by-n grid drawn on paper. ... First the player puts a 1 in any of the grid's ... squares next to the last integer written in the ...
    (rec.puzzles)
  • Jumping Farther & Farther: Grid Game
    ... n-by-n grid drawn on paper. ... But this game does not seem that familiar. ... (Player 1 places the odd numbers into the grid, ... Player 1 can place the 1 in any square. ...
    (sci.math)
  • Jumping Farther & Farther: Grid Game
    ... n-by-n grid drawn on paper. ... But this game does not seem that familiar. ... (Player 1 places the odd numbers into the grid, ... Player 1 can place the 1 in any square. ...
    (rec.puzzles)