Rotating backgrounds ... ???

Started by DrewCCU, Sun 11/04/2010 19:16:20

Previous topic - Next topic

DrewCCU

okay ... this is going to be a little tough to explain ... but let me try.

My friends and I are working on designing a part of our game where you are piloting a space ship.  Take a look at this mock-up and it should give you a better visual idea of what's going on.


*note: the game is in 800x600 resolution but the space background will be larger to allow a panning effect*

My idea is when the player moves (say left) by pressing the left arrow key the space background pans and makes it appear as though you are "moving" left. Same thing should happen in all other directions. The trick here is this:

When you get all the way to the left edge of the space background i don't want you to stop. Because in real life why would u stop? you would keep going and just turn around 360 degrees.  So i need the effect as though you're spinning in a circle.  (whether you go from left to right, right to left, top to bottom, bottom to top) you should always end up back where you were.

Just to clarify, you won't actually be moving in space - as from one point to another. You are more or less sitting in one spot and spinning all around looking at whats around you. (the moving from point a to point b will be done a different way)

i'm sure you probably understand what i'm looking for by now but just to give you a little something extra to make sure:
Visualize yourself in a spaceship in real life. Imagine say a planet in the middle of the ships window/viewscreen/whatever u want to call it. Ur looking at it through your space ship.  You begin to turn your ship left.  Well what is going to happen is you are going to see the planet leave your view (exiting to the right - cus ur turning left) and then eventually you are going to get back around to it.

So i guess my ultimate question in this big long mess of a post is:
How can i pan my space background (using arrowkeys) and cause it to when it reaches the left edge of the background to the switch over to the right side of the background and still continue panning left? (same goes for all other directions)

I know this may be complicated - or it may be very simple (there have been things i made out to be really complicated but turns out what took me like 20 lines of code took someone else 2).

Eitherway, all suggestions/ideas are welcome.

THANKS!
"So much of what we do is ephemeral and quickly forgotten, even by ourselves, so it's gratifying to have something you have done linger in people's memories."
-John Williams

Pumaman

If you have the space background in a sprite, you could use the DrawingSurface functions to draw it twice side by side, with the x co-ordinate varying as the player presses the arrow keys.

DrewCCU

#2
Quote from: Pumaman on Sun 11/04/2010 19:39:57
If you have the space background in a sprite, you could use the DrawingSurface functions to draw it twice side by side, with the x co-ordinate varying as the player presses the arrow keys.

i'm not very familiar with the drawingsurface functions. would this allow it to appear as though your constantly going in circles by holding down a direction key?

EDIT:
Also, keep in mind that if there is a planet on the screen, i would want u to be able to rotate (or appear to rotate)  360 degrees and come back to that planet
"So much of what we do is ephemeral and quickly forgotten, even by ourselves, so it's gratifying to have something you have done linger in people's memories."
-John Williams

Ali

I think the easiest thing might be to use McCrea's Panorama module.

Or if you follow CJ's suggestion of using a repeating star backdrop, you could add planets as objects. Like the backdrop, their positions would be affected by pressing the arrow keys.

So holding down the left arrow moves all the planets to the left. Then when the planets' X reach (say) -800 you set their X positions to 800 and watch them come into view again from the right. This would also allow the planet's sprite to animate, scale or move which might allow for certain effects.

SMF spam blocked by CleanTalk