#is there any alternative to move_toward for my game?

1 messages · Page 1 of 1 (latest)

fading summit
#

I’m trying to make a game that revolves around frictionless 8-way movement. The idea is that you’d have “boosters” that accelerate you in the held direction up until a max speed variable, and then you can accelerate past that with other movement options that I haven’t implemented yet.

As I’m going through the basic movement, though, I’ve realized I’m going for something more complicated than move_toward seems to be allowing me to do.

As it works right now, when I hold one direction, it’ll accelerate the player towards it until it reaches the MAX_B_SPEED variable. Since there’s no friction, the player just moves at that speed endlessly. The issues arise when I try to go from holding a direction on the X axis to one on the Y Axis. It causes all previously built speed to lessen until you’re only moving towards the new destination.

What I want is for it to be like a constant add on. Holding a direction shouldn’t dictate all movement, it should more or less influence it.

For a visual example of how it’s working now, in the video I-

Hold left
Hold up+left
Hold down

I’m trying to make it so that the movement on the X axis and on the Y axis are combining rather than canceling each other out.

upbeat bison
#

It sounds like you want to handle movement in x and movement in y separately? Just do that: calculate movement in x, and movement in y, and then combine them (via addition).

fading summit
#

that's what I was hoping to do, but I'm not entirely sure how to put it into gdscript 😅

#

I can work through what I need to make happen just fine, but I'm not too well versed in gdscript yet and I haven't found any tutorials or guides that have made it any easier. is there anywhere specific I should be looking for that kind of info?