How to teleport an actor without using constrain atributes?

GLAGLA Member, PRO Posts: 60
How to teleport an actor in a specified position(well known x and y values, lets say x=480, y=320) but without using the cnstrain atributes command?

Comments

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Can you not use change attributes?
  • GLAGLA Member, PRO Posts: 60
    i tried...isn't working...the actor remains in the same position
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited October 2013

    Hi @GLA, if you don't need to have "remembered" where a moving actor is teleporting FROM, then you've no worries about using Constrain Attribute behaviours anyway in this situation... (but if you had to use Constrain Attribute behaviours, I'm wondering why you'd want to avoid them...)

    (btw, for the record - and I'm sounding picky but it might confuse some new users not familiar with programming so I'll mention - the Constrain Attributes are behaviours, not commands.)

    Anyhow, simply use Change Attribute behaviours:

    Rule: When scene.ReadyToTeleport01 is true
    Change Attribute self.Position.X to 480
    Change Attribute self.Position.Y to 320

    Edit: writing as @KevinCross was posting

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

  • GLAGLA Member, PRO Posts: 60
    let me be more clearly...i have an actor outside the scene and when some atribute changes to true i want that actor to apear in the middle of the scene, and when is false to go back to the initial position outside the scene...but i don't want to use constrain atributes cause in that way they will be to much and will crash the game...so any solutions? :D right now i'm trying with spawning actor, and then destroy when that atribute is false
  • GLAGLA Member, PRO Posts: 60
    sorry for confusing the words, i'm not a native english speaker
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    I think I use change attributes in my game when I wanted it to go on and off the screen depending on the value of a boolean. I used it for a reset/restart game button.

    I don't see why constrain attributes would be too much and would crash your game. If it currently happens then you may have other problems.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited October 2013

    So based on this new info, perhaps try my updated suggestion (using Change Attributes as @KevinCross suggested):

    Rule: When scene.ReadyToTeleport01 is true
    Change Attribute self.Position.X to 480
    Change Attribute self.Position.Y to 320
    Otherwise
    Change Attribute self.Position.X to -60

    Or if you still want to use a spawned actor, put in the spawned actor's Rules:

    Change Attribute self.Position.X to 480
    Change Attribute self.Position.Y to 320

    Rule: When scene.ReadyToTeleport01 is false
    Destroy

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

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited October 2013
    As others have said it seems like it should be a simple matter of using Change Attributes to move a character to and from the spots.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    Here is a little sample file that moves an actor between two spots on screen when the button is pressed.
  • GLAGLA Member, PRO Posts: 60
    thanks a lot all of you! i found what was the actual problem :) sorry my mistake :)
    thanks for the sample too
Sign In or Register to comment.