Quick Question

Discussion in 'Public Game Developers Forum' started by CladCreations, Mar 30, 2009.

  1. CladCreations

    CladCreations Member

    Feb 23, 2009
    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
  2. WellSpentYouth

    WellSpentYouth Well-Known Member

    Jan 11, 2009
    iPhone programmer
    App Tech Studios, USA
    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!
  3. grid

    grid Well-Known Member

    Feb 17, 2009
    iPhone Game Dev
    Minneapolis, MN
    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:

    	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.

Share This Page