Spawn Actor Where You Press Help

FallacyStudiosFallacyStudios Member Posts: 970
edited February 2012 in Working with GS (Mac)
Basically it is exactly as it says. I would like when you press in a location that an actor will spawn there. I have an actor that is stretched along the entire of the scene (1000x1000). It is transparent and is basically there to register when someone touches somewhere. When all the conditions are met and someone clicks the location they would like the actor they are spawning it ALWAYS spawns somewhere within the original 480x320 screen region. I have it set up so that the actor should be spawning on the X&Y location of Device>Touch>X (& Y). It is set to relative to scene in both the direction and the XY area. It just continually spawns in the first 480x320 area.

Any help would be greatly appreciated.

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited February 2012
    Youll need to add an offset for the camera.
  • FallacyStudiosFallacyStudios Member Posts: 970
    @JohnPapiomitis
    That sounds like it would be right. I just put a box in there to show me what the touches are registering as and no matter where I scrolled too and clicked on the screen it was always within 480x320.

    How would I offset the camera?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited February 2012
    in the spawn behavior for the x position have touch.1.x+camera.origin.x and for they y have touch.1.y+camera.origin.y

    you can either have a seperate actor thats unlocked that constrains 2 game attrubutes to the camera x and , or you can unlock the spawn actor and then you can access the scene atrbitues in the spawn behavior

    cheers
  • FallacyStudiosFallacyStudios Member Posts: 970
    @JohnPapiomitis

    Thank you that works well.
  • poopdecksweeperpoopdecksweeper Member Posts: 180
    Hi guys I wanted to see if the same thing could be done to a "shot" actor? I need the right rules to be able to have the shot go towards my finger, on a scene that is exactly like the one mentioned above. My actor is an alien, and when I touch on the lower part of the screen, the shot ONLY flies towards the lefthand scene (the first 480 pixels of a 960 pixel wide scene).

    What are the rules I need to make on my Accelerate angle......right now I have: VectorToAngle(game.touch.X- self.position.X,game.touch.Y-self.position.Y)

    I know that I need to offset camera, but how do I do it when the "shot" actor is not on the scene yet because it spawns on touch.

    I dont get it
  • poopdecksweeperpoopdecksweeper Member Posts: 180
    bump
Sign In or Register to comment.