how can i write a game like this...

it is a top-view game. The map include
blocks(be able to walk through/ not able) and characters.

i want the character whom is under control walks to anyplace i need, and he avoids the blocks that unable to walk through, reachs the goal.

thank you
RkMkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

My name is MudSystems EngineerCommented:
Hmmm... like a labyrinth or so...

Is quite simple, first made a TEXT MAP, like for example a "*" character will be a wall, "#" will be grass, "@" will be a tree, etc... and divide the screen view [graphics mode] in pieces, like 16x16 pixels or 64x64, draw them [the grass, trees and walls, etc make them with paint brush or something] then do a scan of your TEXT MAP, if the first character is a "*" wall, then Draw the wall in a box 16x16 or 64x64, then scan again the TEXT MAP, if you encounter a "*" wall again then draw the wall in distance 64pixels from where you draw the first one, and on and on...

(some thing like this)
*********
*####      *
*##  #  @   *
*    @     *
*********
0
My name is MudSystems EngineerCommented:
So once you design the graphic engine, do the Movement engine, with a bunch of rules, like the character in question can't pass thru tree nor wall, but can pass thru grass,

{For UpMovement}
If Key = 'up' Then
  Begin
    If ((Array[X,Y+1] <> "*") and (Array[X,Y+1] <> "@")) Then
      Y:=Y+1
  End;
{For DownMovement}
If Key = 'down' Then
  Begin
    If ((Array[X,Y-1] <> "*") and (Array[X,Y-1] <> "@")) Then
      Y:=Y-1
  End;
{For LeftMovement}
If Key = 'left' Then
  Begin
    If ((Array[X-1,Y] <> "*") and (Array[X-1,Y] <> "@")) Then
      X:=X-1
  End;
{For RightMovement}
If Key = 'right' Then
  Begin
    If ((Array[X+1,Y] <> "*") and (Array[X+1,Y] <> "@")) Then
      X:=X+1
  End;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
My name is MudSystems EngineerCommented:
The Graph engine could be like (if sprites are 16x16)

Type
  ArrayGrp = Array[1..4,1..16,1..16] of Byte;
  ArrayMap = Array[1..16,1..16] of Char;

Procedure ReadSpritesFromFileOrSomething;
Begin
  {Read the sprites from file, or generate them [bad idea]}
End;

Procedure PutSprite(X,Y: Integer; What: Char);
Var
  I,J: Byte;
Begin
  Case What Of
    "*":
       Begin
         For I:=1 to 16 Do
           For J:=1 to 16 Do
             PutPixel(i,j,ArrayGrp[1,i,j])
    "@"
       Begin
         For I:=1 to 16 Do
           For J:=1 to 16 Do
             PutPixel(i,j,ArrayGrp[2,i,j])
    "#"
       Begin
         For I:=1 to 16 Do
           For J:=1 to 16 Do
             PutPixel(i,j,ArrayGrp[3,i,j])
       End;
End;

For i:=1 to 16 Do
  For j:=1 to 16 Do
    PutSprite((i-1)*16, (j-1)*16, Array[i,j]);



And so...

[this was made on the fly, so you'll need much more, well actually not that much]
0
HypoCommented:
The first time I made a "from above" game like the one you describe,
I made a map of X*Y bytes... where Each byte in this map pointed into an array of Sprites with fixed bounds: 16*16.
When I was to update the screen, I scanned through the map and put each sprite where the map said it was supposed to be. (similar to whatboys way of doing it)

Anyway: If you want commented examples,
I need your email...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Pascal

From novice to tech pro — start learning today.