Platformer floor hit testing

Creating Games? Developing something for fun?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Platformer floor hit testing

Post by monte » Sun Dec 02, 2012 11:40 pm

Hi

I'm very new to games so I may have this all wrong. I'm playing with a platformer and have a character doing an nice walk left, stand, walk right animation and jump with gravity. The next thing I need to do is add some obstacles and platforms to jump to etc. I'm trying to work out the optimal way to hit test when the character has hit a side of an obstacle so I'm looking for ideas. Obviously we don't want to hit test on every obstacle on the level each move so I was wondering about creating an array or list of obstacles when the game starts and somehow filtering it to obstacles within a reasonable range of the character. Anyway... interested in ideas or methods on what is normally done.

One idea that occurs to me is designing the whole level in an image editor and then just using intersect on the level image. Probably not the best memory and processor wise but it sure would simplify the game design... I guess you could get the same thing by grouping all the obstacles and floor and using intersect on that... which would reduce memory use but not processing on the intersect.

Cheers

Monte
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Platformer floor hit testing

Post by shaosean » Mon Dec 03, 2012 6:33 pm

Malte had a game where you had to jump up some platforms which I believe he made using Animation Engine (or Arcade Engine as it was originally called ;-))

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: Platformer floor hit testing

Post by monte » Mon Dec 03, 2012 11:44 pm

Hmm... I'll look into animation engine but I was hoping for a simple solution because I'm doing this for some app dev workshops at the local community centre. I'm using some of the CC game designs from http://www.vickiwenderlich.com for game loop examples. First one is mole whack (good example of using layers to make the hole), then cat jump (side scroller) and now Im playing with super kuwalio (platformer) although I might follow on from cat jump with space flier because they are both side scrollers but space flier has a parallax background rather than static.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Location: Thailand
Contact:

Re: Platformer floor hit testing

Post by dave_probertGA6e24 » Tue Dec 04, 2012 6:54 am

Hi,

You might want to try and check out the Game Academy videos - if you can. They dealt with collision detection and so forth. You should get a good understanding of some of the processes from those.

Cheers,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: Platformer floor hit testing

Post by monte » Tue Dec 04, 2012 8:01 am

Hmm, I understand collision detection. What I'm looking for are optimization methods if the character can move around the whole level. I've since just tried a method where some attributes of tiles Are preloaded into an array at game start and then looped over each move. Seems to work fine on desktop but I don't know about mobile. I'm not using intersect in alpha values so maybe that's the main issue.

Cheers

Monte
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: Platformer floor hit testing

Post by monte » Thu Dec 13, 2012 3:59 am

Seriously simplified things when I moved to two separate object types. Floor and barrier. Floors only stop the object moving down. Barriers only stop the object moving left and right.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Post Reply

Return to “Games”