When touched spawn actor

EminemEminem Member Posts: 667
edited November -1 in Working with GS (Mac)
I know how to when touched anywhere onthe screen it spawns but what I want to do is the same thing but only when pressed on actor.

So what I need is when the user touches anywhere on the actor it spawns on the exact location the persons finger has landed???

Thanks Appreciate it

Comments

  • osucowboy18osucowboy18 Member Posts: 1,307
    Hey Eminem, here's what you will need to do. Create 2 game attributes of type real, game.TouchX and game.TouchY. Next, in the actor that will be touched, add the following behaviors.

    Constrain Attribute game.TouchX to game.Touches.Touch 1.X
    Constrain Attribute game.TouchY to game.Touches.Touch 1.Y

    NOTE: Touches.Touch 1.X can be called by selecting the Expression Editor, then choosing "Devices", then "Touch", then "Touch 1", then X.

    After adding those behaviors to the actor, add this rule.

    Actor receives event touch is pressed...
    Spawn Actor "actor name"
    X = game.Touch X
    Y = game.Touch Y

    Hope this makes sense.
  • EminemEminem Member Posts: 667
    WOW! Thank you both of you! I incorporated both of your post and i ended up with an awesome working system thanks Again!
  • EminemEminem Member Posts: 667
    ahahaha TSB method was easier so decided to go with that but osucowboy18 i learned something that i didnt know was possible i found touch 1 and touch 2 ,ect (didnt know gs had that) :P
Sign In or Register to comment.