I need help with how I want the player to move. I want the movement of the game to be mouse based, i.e I want the player to jump up left when moving cursor to the left of the slime and jump up right when mouse is to the right of the slime. How would I be able to achive this? I've tried to test something if it'll work, and it didn't.
What I tried was
if stat(34)==1 and (on_ground or jump<2) and SX==8 and sy==8 and mouse.x<x then
on_ground=false
jump+=1
dy=dy-1
sfx(0)
end
This doesn't work since whenever the X cord for the mouse is less then the slime X, or x, it still jumps. Is there something I'm not thinking of that could work?



Very simply, @Dawnoboo, you want to calculate the distance the mouse has traveled between two tightly timed points. If in fact the button is released, that becomes the speed, direction, and inertia of the object released.



@Dawnoboo the x velocity would be cos() of the direction and the y velocity would be sin() of the direction



Well it could be cos() or sin(), @ooooggll. Yet that is not required.
A simple coefficient with gravity would work.
I'm headed to midnight mass right now but if no-one writes any code to demonstrate this principle I will do so on Christmas Day.
And - Happy Holidays everyone ! 🎄



Thank you so much, I'll make sure to check it out tomorrow, happy holidays to you as well!!!



Good afternoon and Merry Christmas, @Dawnoboo.
You will find your heavily documented code to do just this HERE:



Thank you so much!!! This really helps with the movement, happy holidays!
[Please log in to post a comment]