Page 1 of 1

Weird glitch using the switch(state) method

PostPosted: Sat Aug 18, 2012 1:12 am
by supatails
I've been practicing using the switch(state) method described on this page: http://game-editor.com/State_Method
And I'm grasping a descent understanding of how it works, but I'm encountering a weird glitch:
Jumping works fine, and even moving in mid-air, but if I move around, and then jump, my characters velocity acts funky and he slides away off screen. (I haven't parented the view yet)
Here's a demo, and I've included a ton of the "//description" things in the script so you guys can get an idea of how I have it set up. Please help, i feel like if I can get past this minor glitch, I'll be capable of blasting through this game. Thanks in advance for anyone willing to help! :D

EDIT: I made a text actor which displays the State as a number on screen. While floober is moving across the screen, it still says that the state is one of the idle states: 0 or 1. :?

Re: Weird glitch using the switch(state) method

PostPosted: Sat Aug 18, 2012 1:20 am
by skydereign
This is caused by your PhysicalResponse. Normally you should set the last two values of the function to 0. Essentially what is happening is the function is having the actor bounce on the ground, and that sets the xvelocity to some value. To fix it, change your top side collision with the ground's first line to the PhysicalResponse you used in the left or ride side collision.

Re: Weird glitch using the switch(state) method

PostPosted: Sat Aug 18, 2012 1:44 am
by supatails
No way, that was incredibly simple! XD I was totally overlooking the obvious, thank you so much sky! +1