Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Moving over an unleveled terrain

Author
Message
JORGEMAL
14
Years of Service
User Offline
Joined: 2nd Aug 2009
Location:
Posted: 17th Oct 2013 22:35
How can I move a character over an unleveled terrain?
My game will have an unleveled terrain with small hills so a character must walk following the non-uniform terrain moving accordingly.

We thought about using 2 sprites (the character and the terrain) and detect collision between them, but we are sure there must be a better solution.

Please see attached sample image.

Regards,
Jorge Maldonado

Attachments

Login to view attachments
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th Oct 2013 23:04 Edited at: 17th Oct 2013 23:08
you can make a array for y values.
dim height[screenwidth]
h=height[player.x]

and the sprite offset y for player at feet.

i would move the player at first manual and put the values in this
array and save it.
then you can load the array and use the values.
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 18th Oct 2013 01:25
You could also use the physics system.

Place Static Physics Sprites to outline the map and make them invisible
Then make the character a dynamic physics sprite and use SetSpritePhysicsCanRotate(spriteID,0)

Use SetSpritePhysicsImpulse() to move the player, you'll need to set it's restitution very low (so it doesn't bounce) and that sort of thing.


formerly MissJoJo - Audacia Games
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 24th Oct 2013 18:08
I use Markus's idea. If the level is wide (my level is 8 screens wide) then I just sample every n pixels and interpolate the rest.

Login to post a reply

Server time is: 2024-05-20 07:34:36
Your offset time is: 2024-05-20 07:34:36