Skip to main content
gamedev.net
🔒 Locked

Grid Game With Delphi

Started by Daboy Nov 21, 2001 at 2:12 PM 10 replies 950+ views
Original Post
Daboy
Daboy
Hey, i was wondering if i had a map how easy would it be to have a guy move around the map using the mouse or keyboard??So basicly i have a map and a guy but how can i get the guy on the map and move him??? Thx
Jordan Weberwww.pheonixsoftware.com
Sly
Sly
The ''guy'' knows where he is on the map by remembering the X and Y coordinates of where he is. When he wants to move, he checks the neighbouring map cell in the direction that he wants to move to see if he can move there or not. For example, if he wants to move left, he checks the map cell at (X+1,Y) to see if it is not a wall or rock or something similar. If he can move there, then he updates his own coordinates.

To use mouse or keyboard, either use the OnKeyXX or OnMouseXX events of the form or control.

To show the map and guy, draw the map from left-to-right, top-to-bottom, and then draw the guy at the coordinates the guy knows he is at.

Steve ''Sly'' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers
Sly
Sly
I don''t have any example code on me. That was all off the top of my head. Not much time to write any sample code either. Being lead programmer on a big title for PS2 doesn''t leave one with much spare time.

Steve ''Sly'' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers
MButchers
MButchers
http://www.gamedev.net/reference/list.asp?categoryid=44
Vladimir Vasilyev
Vladimir Vasilyev
You can find the demo of RTS Game founded on DelphiX and two
tutorials about map making on:
http://www.gamedev.narod.ru
benwatt
benwatt
Hi,

You might want to try the tutorials on my site, two of which introduce creating a tile-based game. The site is http://www.delphigamedev.com

Hope that helps,

Ben Watt
delphigamedev.com
Lumin
Lumin
Yeah the tutorials at Ben''s page should get you going.

keep up the good work ben!
benwatt
benwatt
Thanks guys,

Your kind words are appreciated!

Cheers,
Ben Watt
delphigamedev.com

P.S. Be sure to return the favour once you get good with Delphi/Kylix, and write some tutorials for the site

Edited by - benwatt on November 26, 2001 10:17:15 AM

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.