Draw Straght Line That Follows Your Finger

Hey guys.I was trying to make the "draw a line" TSB tutorial and it actually works very good,i would like tho to add the feature to be able to show the line while im touching the screen and not only when im releasing my finger.Any thoughts on how can i accomplish that?Thanks :>

Comments

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    use 'constrain attributes' while touch is pressed.... I'm assuming 'change attribute' is used at the moment. . . if not hopefully someone who is familiar with the tutorial will help.
  • jackwhittejackwhitte Member Posts: 6
    Indeed 'change attribute' is used.I changed it to 'constrain attribute' but it doesn't work.The line does not appear in the screen anymore.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Learning to draw a line in GameSalad is not a trivial thing. But it is a great way to learn many of the fundamentals. When developers can do a simple line (and understand why it is done the way it is), they are well on their way to mastering some of the most powerful concepts in GameSalad. (Actor Positioning, Creating Attributes, Changing vs. Constraining Attributes, Magnitude, VectorToAngle)

    Here goes!

    Change Attribute: self.Size.Height To: 2
    When mousebutton is down
    -- Change Attribute: beginX To: game.Mouse.Position.X
    -- Change Attribute: beginY To: game.Mouse.Position.Y
    -- Constrain Attribute: self.Position.X To: ( game.Mouse.Position.X + self.beginX )/2
    -- Constrain Attribute: self.Position.Y To: ( game.Mouse.Position.Y+ self.beginY )/2
    -- Constrain Attribute: self.Size.Width To: magnitude( game.Mouse.Position.X - self.beginX , game.Mouse.Position.Y - self.beginY )
    -- Constrain Attribute: self.Rotation To: vectorToAngle( game.Mouse.Position.X - self.beginX , game.Mouse.Position.Y - self.beginY )
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Blown away from your post, @RThurman.
  • jackwhittejackwhitte Member Posts: 6
    Thanks!!!I will try that as soon i ll get back home!
Sign In or Register to comment.