• Advertisement

Archived

This topic is now archived and is closed to further replies.

Grid Game With Delphi

This topic is 5935 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Ok cool i understand that....if u have time would u mind giving me an example code for that???? Thx

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Do you know any good tutorials for tile games???

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Ok ive drawn a map and a "Guy" now to the hard part...whats the code for making it able to move??? Thx

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hey Ben,

I love the site. Keep up the good work. You helped me greatly.

Share this post


Link to post
Share on other sites
Yeah the tutorials at Ben''s page should get you going.

keep up the good work ben!

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement