Help With Gamesalad Control

ok so i want to make a game which uses a rub technique like this game
Image and video hosting by TinyPic

so say that that rub actors on the screen 3 seconds i want to make it so the faster you rub for that 3 seconds the faster my other actor will go is there a way to do this ?

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    edited February 2013
    That's a cool idea! Here would be one way to implement a "rub" speed:

    When MouseDown
    --Timer (every 0 seconds)
    ----Change Attribute: self.rubSpeed To (self.rubSpeed *.96)+(abs(game.Mouse.Position.X-self.oldX )/(self.Time-self.oldTime )*.04)
    ----Change Attribute: self.averageRubSpeed To: (self.averageRubSpeed +(self.rubSpeed/9))*(.9)
    ----Change Attribute: self.oldTime To: self.Time
    ----Change Attribute: self.oldX To: game.Mouse.Position.X

    You would need to make four self attributes -- all of type real:
    rubSpeed
    averageRubSpeed
    oldTime
    oldX

    Also, you can't simply copy and paste in the equations. They need to be built with the expression editor.
  • JordeyyJordeyy Member Posts: 409
    @RThurman thanks bro i will try that now
  • JordeyyJordeyy Member Posts: 409
    @RThurman could this be done with the when touch is pressed cause on iphone there is now mouse ?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @Jordeyy in GameSalad, the word "mouse" also refers to any touch (e.g. tap) on a device.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • JordeyyJordeyy Member Posts: 409
    @tatiang thanks for clearing that up for me also if you look at the image i suppliced would i need to apply all that the actor RUB or the Actor thats moving cause i want to rub the Rub actor and from that i want the other actor eg a bike to move ?
  • JordeyyJordeyy Member Posts: 409
    @RThurman thanks for clearing that up for me also if you look at the image i suppliced would i need to apply all that the actor RUB or the Actor thats moving cause i want to rub the Rub actor and from that i want the other actor eg a bike to move ?
  • JordeyyJordeyy Member Posts: 409
    @tatiang help please ?:)
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    You might put the result (self.averageRubSpeed) into a game attribute instead (game.averageRubSpeed) and then use it to formulate the bike speed.

    For example in the bike actor you could have:
    Constrain Attribute: self.velocity X To: game.averageRubSpeed*.25
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited February 2013
    @Jordeyy to be honest, RThurman is your best bet for help since he's a our resident math expert. I was just commenting on the fact that rules referring to "mouse" work just fine on a touch device. I actually don't understand your question the way you wrote it. Too much of a run-on sentence. But if you're patient I'm sure RThurman will get back to you.

    Edit: et voila!

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • JordeyyJordeyy Member Posts: 409

    @RThurman Thanks the way you said worked :) thanks alot
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    You are welcome!
Sign In or Register to comment.