You want to use vectors! :) Read that blog post and the next two in the series, to get a good start.

Then, all you need to know is that the formula for a unit vector pointing in a certain direction is just (x = cos(angle), y = sin(angle))

(BTW, congrats - you’re one of today’s lucky 10,000 on vectors! Well, maybe perhaps a bit less than 10,000, since vectors probably aren’t something everyone knows by the time they’re 30…)

UP, DOWN, LEFT, RIGHT.. is pretty straight forward with X/Y coordinates.. Reduce, increase them..

But what If I do not want restricted movement like that? I would like to move a spaceship into any chosen 2D direction.

On a Grid I would do something like this:

(pseudo code)

Grid_Array = [

[0,0,0],

[0,0,0],

[0,0,0]

]

If move request is “UP” {

Each Second:

player = Grid_Array[player.y - 1][player.x]

}

But How would I do this without a grid, and into every direction?

Every Second:

Move player X,Y at 360 angle.

Haeelp!

(It’s something with sin/cos isnt it?