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 / Sticky walls

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 9th Aug 2014 08:12
i made a platform game, that can jump and move to left and right. now when I jump and Press left or right key, my character Stick to wall. how can disable wall Adhesion?

Thanks.
Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 9th Aug 2014 09:50
Physics or your own code-based controllers?
Post some code for better chance at someone helping

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 9th Aug 2014 10:04
here is my code:

Naphier
13
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 9th Aug 2014 10:13
You'll need to set up something other than the screen walls so that you can test for collision and stop the horizontal velocity.
I was looking for some commands for friction to see if that could help out, but AppGameKit physics are pretty primitive

Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 9th Aug 2014 11:01 Edited at: 9th Aug 2014 11:03
Behdadsoft, you could do this with the RayCast commands. For our platform game I crated a RayCast from the center of my character to a couple pixels below his feet, and the same from center to right and center to left. I then used these to see if the character had collided with the walls (my own walls, like Naphier's suggestion). You can also use this for the Jump by making sure the character is on the ground.

Here's a code snippet from my app to prevent the wall sticking;



And this is for Jumping;



If you need to see the RayCast set up, let me know...
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 9th Aug 2014 11:27
Thanks Funnell7.
could you add RayCast to my code and fix sticky wall?

Login to post a reply

Server time is: 2024-05-12 14:17:21
Your offset time is: 2024-05-12 14:17:21