My character only moves right and down

i made some movement code that was a bit different, because i had the idea that it would work better.

but it only lets my character move down and right. is there something wrong with my code?

That logic seems OK to me - maybe post a link to the game so we can take a look?

here you go

OK, I see the problem. I think you probably realize this, but it is helpful when debugging a problem like this to run the game from the behavior window so that you can see how the logic is being evaluated.

Anyway, here’s what is happening:

All 4 of the numbers being sent by the Once trigger into the Velocity block are running every frame. So in the case of the x axis, first it is set to -10, which is what we want, but it is then set to 0 immediately after that by the Number block below it.

Moving to the right works, since it is first set to 0, and then set to 10 after, so it works fine. The y axis has the same problem.

I think you can probably fix this by only using two Numbers connected to your Velocity - one for x and one for y. They would always get set to either 10, -10, or 0 every frame.

thanks grazer! it’s working great now.