Scene touch constrain issues

poopdecksweeperpoopdecksweeper Member Posts: 180
edited February 2012 in Working with GS (Mac)
I have an iPhone game that the scene is 960 pixels wide, and I need to be able to have my character (an alien floating at the top of the screen) able to shoot where I touch when I have my character fly to the very right part (the second 480 pixels out of a scene that is 960 wide) of the screen.

So just to explain: if I touch anywhere in the first 480 pixels of the scene he will shoot wherever I touch, but when I go rightwards past 481 pixels the camera must not shift and the character will not shoot where i touch but only in the beginning 480 pixels of the scene.

I tried to make the shooter actor stay on the layer that my hud is on but I still get nothing.

Comments

  • poopdecksweeperpoopdecksweeper Member Posts: 180
    bump
  • poopdecksweeperpoopdecksweeper Member Posts: 180
    bump2
  • FallacyStudiosFallacyStudios Member Posts: 970
    edited February 2012
    @poopdecksweeper

    Sorry but worded very confusing. If I understand you right, you mean when your camera is in the 0-480 you tap there he shoots. If you want to shoot in the 480-960 area you fly there and then when you tap you want him to shoot?

    If your problem is that it is not shooting in the 480-960 area it would most likely be because the camera needs to be offset.
  • poopdecksweeperpoopdecksweeper Member Posts: 180
    Sorry, you are right about the first part, when my alien character is in the 0-480 I tap anywhere and he will shoot, but then when I cross over into the 480-960 if I shoot, he will direct the shot towards the 0-480 on the exact spot I am touching in the 480-960. It is almost correlational.

    So yes, I think that the camera needs to be offset once I enter the 480-960, but I don't know how.

    I can send the project if need be to check it out
  • FallacyStudiosFallacyStudios Member Posts: 970
    edited February 2012
    @poopdecksweeper
    Well if you want to send it I'll see if I can put it in for you real quick before I go to class. If not here is how to do it.

    I'm not sure on the specifics of what you have in your game actor wise so I'll just tell you how I did it in my game that I looked at.

    In my Cam actor (which I use for scrolling from side to side) I put a Constrain attribute for a global attribute of Camera X. It constrains the Camera X to Actors self.position x-240. (The actor is in the exact center of the camera)

    Then where ever you have it coded to shoot to the touched location have it add Camera X.

    That should make it shoot to the right location. Obviously since yours requires both X and Y I assume you will need to do the same for Y. Just make sure that you do a Camera Y constrain to self.position y-160. But you may not need Y, I don't know how your game is set up. (If Y is the standard 360 you wouldn't need it I don't think)
  • poopdecksweeperpoopdecksweeper Member Posts: 180
    yea I can't figure it out. Where should I send it?
  • FallacyStudiosFallacyStudios Member Posts: 970
    edited February 2012
    Well you can upload it to dropbox and send me the link or send it to FallacyStudios [@] gmail.com

    Just to let you know though I'm about to leave and won't be able to get to it until I get back a few hours from now if that's ok.
  • poopdecksweeperpoopdecksweeper Member Posts: 180
    ok no prob, thanks for your help.
Sign In or Register to comment.