Help with teleporting actor ,etc.

NinjaCatsNinjaCats Member Posts: 3
edited June 2014 in Working with GS (Mac)

Hi, i just started trying out game salad and began brewing up ideas.
1) im trying to figure out how to teleport a actor when clicking or touching the screen in the area, i would like him to go (kind of like nightcrawler) How exactly would i go about it? I tried using a rule to delete him then appear at the spot of the click (or touch) but can't seem to figure it out. also having a problem with him going off screen and cant seem to keep him in screen. any help would be greatly appreciate.

2) also trying to figure out how to make him swing a sword then go back to standing animation.

Thank you
NinjaCats :3

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hello @NinjaCats and welcome to the GameSalad Forums.

    To "teleport" an actor is relatively simple: just add two Change Attribute behaviours, one for the new X coordinate and the other for the Y.

    For your player to swing a sword, there are two ways I can think of to do that - probably the easiest is to have animation frames. If the sword swing is produced when the user presses a button perhaps, you could use something likes the following in the button:

    When touch is pressed
    Loop Behaviour --- or a Timer set to Every
    Animate ---- your sword swing frames
    
    When touch is released
    Animate --- your frames going to the standing position
    

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • NinjaCatsNinjaCats Member Posts: 3
    edited June 2014

    Thank you for the response and info

    Could you explain a little deeper on the teleport? what kind of rule would i use or where would i place the changed behaviors at to control him? like teleport wherever i click.

    thank you

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2014

    Hi again, if you wanted to teleport the actor wherever you clicked, then one way to do this is to put the following Rules into your background actor:

    When touch is pressed
    Change Attribute YourTelepActor.Position.X to game.Touches.Touch 1.X
    Change Attribute YourTelepActor.Position.Y to game.Touches.Touch 1.Y
    

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • NinjaCatsNinjaCats Member Posts: 3

    Thank you so much for your help, it works now! :D just one last question if i wanted a timer (like he can only teleport ever 10 secs) how would i go about that?

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2014

    OK, try the following: make a boolean, let's call it Teleport.

    Now amend that Rule in the background actor to:

    Rule: Timer set to Every 10 seconds
    Change Attribute Teleport to true
    --nested in the above Timer --- Timer After 10.5 seconds -- or whatever "window of opportunity" you want to give - in this example, the ability to teleport within a period of 0.5 seconds --
    Change Attribute Teleport to false
    
    Rule: When touch is pressed and Attribute Teleport is true
    Change Attribute YourTelepActor.Position.X to game.Touches.Touch 1.X
    Change Attribute YourTelepActor.Position.Y to game.Touches.Touch 1.Y
    

    If it's not working as expected, change that second Rule to this alternative:

    Rule: When touch is pressed
    Rule --nested in above Rule-- When Attribute Teleport is true
    Change Attribute YourTelepActor.Position.X to game.Touches.Touch 1.X
    Change Attribute YourTelepActor.Position.Y to game.Touches.Touch 1.Y
    

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.