For moving actor on x axis it is better to change the x coordinate, instead of using xvelocity.
Xvelocity with gravity and physicalResponse doesn't work so well, because physicalResponse affects xvelocity.
But if you need to make him move like using xvelocity, but working better, do it this way:
1. Create global integer variable called xvel.
2. Then, where you have your xvelocity been set put xvel instead of xvelocity.
3. In mario's draw actor code write this:
- Code: Select all
x += xvel;
Now, if you set xvel equal to 3, mario will move to right with speed of 3 pixels until xvel is changed to something else.