I need help with my movement script

R

Raidenc04

Guest
So I've been working for hours now trying to set up a perfect movement script. I have everything working but when I go to a corner while holding two keys EX: Down and Right, it will move normally but once I come into contact with the collisions on the ground it will walk just right (which is normal), but then I come into contact with the corner hitting both collisions. Once I hit both collisions my character will look down. I want it to look right if i'm walking right or if i'm going down towards the corner I'm looking down.

here's the link to my script; https://pastebin.com/ZEDPcgF3
 
Last edited by a moderator:
The reason it's not working is that you're resetting the sprite to right again.

Try this instead:
https://pastebin.com/yzMFQbv2

I used pieces of your script, but cut out a lot of redundant stuff.
All you need to change is 'oWall' to a parent object of whatever you want to be able to collide with. For example, if you have walls and rocks, create an object called oParentSolid (or whatever you wanna call it) and make the rock and wall objects have oParentSolid be their parent. Then in the code, replace 'oWall' with 'oParentSolid'.

Let me know if you have any questions.
 
Top