How do I make an actor/image appear when I touch anywhere

loressaloressa Member Posts: 11
edited November -1 in Working with GS (Mac)
I want to make footsteps appear wherever I touch. Like a stamp tool, where they are 'stamped' onto the background and stay there.

Comments

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Use the spawn behaviour.
  • loressaloressa Member Posts: 11
    Yes I get that, but I'm sure I would have to relate it to the mouse/touch position, because if you click and spawn, it's only relative to the game or actor's position. I need to spawn actors wherever I touch.
  • simo103simo103 Member, PRO Posts: 1,331
    I would create two actors, one is the background. Create two attributes TouchX and TouchY.

    Then in the background actor add a rule:

    Actor receives event Touch is pressed.

    Add Change Attribute game.TouchX to game.Mouse.PositionX and a second change attribute game.TouchY to game.Mouse.PositionY and then add a Spawn Actor relative to scen and position game.TouchX and game.TouchY.

    That should do it.

    S
  • RHRH Member Posts: 1,079
    as simo103 said but you dont need the touchX.game and touchY.game.

    You can just have the background actor and when touch is pressed spawn X by touch1X and Y by touch1Y relative to scene.
  • simo103simo103 Member, PRO Posts: 1,331
    RH ... thanks for helping the learning ... good to know.

    S
  • loressaloressa Member Posts: 11
    Thanks RH! It works!
Sign In or Register to comment.