How do get an actor to rotate when touched and when dragged not to rotate and follow my finger?

TimeTime Member Posts: 113
edited November 2012 in Working with GS (Mac)
How do I rotate an actor without moving it, and when I drag it, it doesn't rotate? So I move the actor without rotating and when I hold it down it starts rotating. Does anybody know how to do this or is there any templates? I am currently doing this with two actors but when I spawn in the same actor, the constrain gets messed up and it becomes a mess.

Best Answer

  • ShineyGamesShineyGames Posts: 157
    edited November 2012 Accepted Answer
    I would not worry about that now.
    but there a few tutorials about recycling actors

    Ive sent it

Answers

  • TimeTime Member Posts: 113
    edited November 2012
    Still not answered! Need help!
  • TimeTime Member Posts: 113
    How do get an actor to rotate when touched and when dragged not to rotate and follow my finger? How do I rotate an actor without moving it, and when I drag it, it doesn't rotate? So I move the actor without rotating and when I hold it down it starts rotating. Does anybody know how to do this or is there any templates? I am currently doing this with two actors but when I spawn in the same actor, the constrain gets messed up and it becomes a mess.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    I'd have two local attributes on the actor, x and y. When actor receives touch, set those attributes to the local position.

    Then, if self.x is = to self.position,x
    Rotate
    If self.x is not equal to self.position.x, constrain to mouse.position.x


    You'd want to do something similar for y
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Make three (real) attributes: oldX, oldY, and distance.

    Rule: When touch is pressed
    -- Change Attribute: self.oldX To: game.Mouse.Position.X
    -- Change Attribute: self.oldY To: game.Mouse.Position.Y
    -- Timer after .2 seconds
    ---- Change Attribute: self.distance To: magnitude( game.Mouse.Position.X - self.oldX , game.Mouse.Position.Y - self.oldY )
    ---- Rule: When self.distance > 5
    ------ Constrain Attribute: self.Position.X To: game.Mouse.Position.X
    ------ Constrain Attribute: self.Position.Y To: game.Mouse.Position.Y
    ----Otherwise:
    ------ Rotate
  • TimeTime Member Posts: 113
    Still doesn't work. Can I load up a GameSalad project on here? I want to show you exactly what I mean.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited November 2012
    You need to use self attributes to constrain instead of game level attributes that way theyaren't all looking at the same two attributes. So make the constrains report to self attributes. The problem is that you're spawning multiple actors who report to the same game level attributes.
  • TimeTime Member Posts: 113
    http://www.mediafire.com/?ywtssvfspsnsw8x. I uploaded the file. Can someone please adjust it? When you open the file, you can move the mover and when you press the rotater it rotates the mover as well (which I want). It's just when you press the spawner, it spawns the block and rotater but when you click it then, everything messes it up. @FryingBaconStudios, I tried that but everything gets messed and nothing work. Can anyone adjust this template and upload it back here. It'll be great for the community as well.
  • TimeTime Member Posts: 113
    Sorry to be pushy but did anyone download it or try it out?
  • TimeTime Member Posts: 113
    I'm pretty desperate now, so I willing to pay for the template to be adjusted. $5 for the first guy that can do it.
  • ShineyGamesShineyGames Member Posts: 157
    edited November 2012
    There does seem to be a bug,
    when you spawn a new mover the the rotate attribute no longer works.(i did a show text)
    but if it did work and was not a bug.
    all that would happen is everyone of the movers would turn together at the sametime.
    Is this what you want?

    depending on how many you need i would have them setup off screen already
    and not use spawn at all

    Ps $5 is not that great an incentive ;)
  • ShineyGamesShineyGames Member Posts: 157
    edited November 2012
    Hi ive just made an actor for you.
    Its just 1 actor that rotates when you press and stops and follow when you move
    and theres no timers
    what your email and i will send you it
  • ShineyGamesShineyGames Member Posts: 157
    edited November 2012
    Let me know if thats what your after
    you can spawn them as in video
    Ps. I dont want paying



  • TimeTime Member Posts: 113
    Sure thanks @ShineyGames. My email is bhav40_m@hotmail.com! How exactly would I do it if the actors were off screen? Thanks a bunch.
Sign In or Register to comment.