Hey everyone, I'm having a little problem working out how to do the following, and hope someone can help. My brain doesn't seem to want to grasp it.
I'm making a 2D top down space game (in blitz3d), where the player is always centred in the screen. First I create a planet at certain coords, say -100,-100. This puts it above and to the left of you when you begin at 0,0.
Now, when I move I use velocity_x# and velocity_y# variables to track my speed and move all the planets accordingly (see simple code below). Therefore, when I move left 100 units, the planet mentioned above will be at 0,-100. All good. I also keep a set of variables handy (space_x and space_y) which my velocity variables are always added to. This gives me a sort of global position. erm, maybe.
Now, my problem comes when I want to position my ship somewhere else. Let's say I want to position it at the planet above immediately. How would I go about doing it?
moving the planets
Is this the best way to do it, or am I overlooking something very simple?
I'm making a 2D top down space game (in blitz3d), where the player is always centred in the screen. First I create a planet at certain coords, say -100,-100. This puts it above and to the left of you when you begin at 0,0.
Now, when I move I use velocity_x# and velocity_y# variables to track my speed and move all the planets accordingly (see simple code below). Therefore, when I move left 100 units, the planet mentioned above will be at 0,-100. All good. I also keep a set of variables handy (space_x and space_y) which my velocity variables are always added to. This gives me a sort of global position. erm, maybe.
Now, my problem comes when I want to position my ship somewhere else. Let's say I want to position it at the planet above immediately. How would I go about doing it?
moving the planets
for p.planet=each planet p\x=p\x+velocity_x p\y=p\y+velocity_y next
Is this the best way to do it, or am I overlooking something very simple?