Check if a tile is in front of you before moving

Non-platform specific questions.

Check if a tile is in front of you before moving

Postby Hblade » Tue May 21, 2013 2:23 am

I have a bootleg way for this rambled up in my head, untested though. But what would be a nice efficient way to tell if there's a tile ahead of you before moving?
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Check if a tile is in front of you before moving

Postby skydereign » Tue May 21, 2013 3:43 am

If you don't have some data structure like an array holding the tiles, you'd need to use either getactor, CollisionFree, or a colliding actor. If you do have a data structure, you just need to check the position to the left to see if it is empty or not.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Check if a tile is in front of you before moving

Postby Hblade » Tue May 21, 2013 3:54 am

If it's not too much trouble, would you mind explaining (or linking to a site that can explain it) a data structure? :)
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Check if a tile is in front of you before moving

Postby skydereign » Tue May 21, 2013 4:14 am

First google search for data structure gives the wiki page. http://en.wikipedia.org/wiki/Data_structure
All you really need is the first sentence from that link. A shorter way of saying the same thing, it is a structure that holds data. Therefore an array is a data structure.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Check if a tile is in front of you before moving

Postby Hblade » Tue May 21, 2013 5:23 am

Thanks
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron