How to make actor stay center on screen?

BobDBobD Member, PRO Posts: 374
edited November -1 in Working with GS (Mac)
I am working on a space game and I want the spaceship to remain in the center as it travels through space. Is there a way to do this? The actor will be able to travel in 360 and everything will just scroll past as it moves thru space.

Comments

  • BobDBobD Member, PRO Posts: 374
    bobdea said:
    I am working on a space game and I want the spaceship to remain in the center as it travels through space. Is there a way to do this? The actor will be able to travel in 360, accelerate or de-accelerate and everything will just scroll past as it moves thru space.

  • osucowboy18osucowboy18 Member Posts: 1,307
    All you have to do is keep your ship at the same X position at all times and have rules in the objects that will fly past it telling it to move at a certain direction. Hope that helps.

    - Alex
    _________________________________________________________________________________

    Target Practice Template
    Custom Soundtracks and Sound Effects For Sale
    Vertical/Horizontal Level Select Template
    Mac Mini For SALE!!!
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    or unlock the ship after dragging it into the scene. Then you can constrain the camera.origin to the ship like this:

    constrain currentscene.camera.origin.X to self.positionX+240
    constrain currentscene.camera.origin.y to self.positionX+160
  • BobDBobD Member, PRO Posts: 374
    Thank you I will give it a try
  • jb15jb15 Member Posts: 602
    Or, insstead of using two constrain attributes, use the camera behavior. You can change the camera settings in the scene > attributes pane.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Or since it sounds like you are using a scene that is larger than the iphone screen.

    So what you should do is drop a control camera behavior in the actor and then reduce the tracking area down to 0x0
  • BobDBobD Member, PRO Posts: 374
    Thank you it works great!!
  • jadjad Member Posts: 135
    nvm
Sign In or Register to comment.