★ TouchArcade needs your help. Click here to support us on Patreon.

Quick Question

03-29-2009, 11:11 PM
#1
Joined: Feb 2009
Posts: 14
Quick Question

I making a game a image(airplane) fly's around the view the question I have is how can I change the background image or view to appear as it is moving and gaining ground.

Say I have 3 pictures I want to loop to look like i am moving how can this be done. WHILE still keeping the flying image(airplane) on the view.

thanks for all the reply's

My First App is almost Done!
Games I'm Playing: SpaceX: Space Ninja: Pocket God: Geo Defense: Light Bike: iShoot;
03-30-2009, 02:14 PM
#2
Joined: Jan 2009
Location: App Tech Studios, USA
Posts: 1,363
Quote:
Originally Posted by CladCreations View Post
I making a game a image(airplane) fly's around the view the question I have is how can I change the background image or view to appear as it is moving and gaining ground.

Say I have 3 pictures I want to loop to look like i am moving how can this be done. WHILE still keeping the flying image(airplane) on the view.

thanks for all the reply's
Well, this is VERY simple and it will NOT work very well, but do if it goes off of one side of the screen it comes back the other and a the old background is hidden and the new one is not hidden. Something like that, not exactly, but this is just a general idea. Good luck Clad!
03-30-2009, 03:02 PM
#3
Joined: Feb 2009
Location: Minneapolis, MN
Posts: 122
Quote:
Originally Posted by CladCreations View Post
Say I have 3 pictures I want to loop to look like i am moving how can this be done. WHILE still keeping the flying image(airplane) on the view.
There's no problem layering Views on top of one another, so the simplest way would just be to have three UIImageView objects, and update them as you update your game. So you could do something like:

Code:
	imageOffset = [Image frame].origin.x + pixelDifference;
	[Image setFrame:CGRectMake(imageOffset, 0, 320, 320)];
You could also just animate the views, if they're always going to move at the same rate. Look at the UIView documentation, particularly the functions under the "Animating Views" section.

My games: ActionChess, Oppo-Citrus & Catchup
blog: http://chesstris.com/ twitter: livingtech GameCenter: grid