How to make actor bounces of when you touch it?

Mile1Mile1 Member Posts: 10
edited December 2011 in Working with GS (Mac)
So i want to know how to make actor that will bounce of in opposite direction when i touch it...
here is the example :D

Than you very much!

Comments

  • Mile1Mile1 Member Posts: 10
    So far I 've made a rule on actor and put change velocity behaviour.
    In direction i've put an expression random(20,160) and it almost works :D
    It's doing the thing i wanted, it bounces of when i touch the screen but because of the random expression it bounces in random ways between 20 and 160 degrees upwards.

    So can anybody tell me what expression should I use to get accurate direction ??

    I've forgot to put an example picture in last post....
    http://imageshack.us/photo/my-images/259/53968434.jpg/
  • Mile1Mile1 Member Posts: 10
    Hello there, I've had problems with logging in on forum.
    So I just want to say thank you very much, that was what I was looking for :D

    P.S. Can you tell me please how to make that actor goes just upwards when you touch on it. somewhere between 10 and 170 degrees.
    So something like that but you can't catapult it downwards

    Thank you very much
  • Mile1Mile1 Member Posts: 10
    Everything (sort of) is ok with this combination
    vectorToAngle(self.position.x - game.mouse.position.x , self.position.y - game.mouse.position.y + self.position.y)

    now the only thing is everything works great when actor is on the floor,
    but when it's on a higher ground (platform) above the half of the screen it doesn't work that well.
    The angle of traveling actor is much smaller...you'll get it when you see the pictures below :D

    On the ground: http://imageshack.us/photo/my-images/535/11045609.jpg/
    On the platform: http://imageshack.us/photo/my-images/593/76155749.jpg/

    Thank you soo much :)
  • Mile1Mile1 Member Posts: 10
    You're the MAN :D
    thank you very much
  • Mile1Mile1 Member Posts: 10
    I have just one more question...
    with all off this the upper half of actor doesnt react to touch, and i want that the whole actor reacts to touch...

    so i've tried with 2 rules one for the upper half and one for the lower half, it sortof works correctly but allmost every time when i touch the upper half of the actor, actor immediately goes up then the lower part reacts with touch and it changes direction (the second rule is activated)
    how can i fix this
  • CloudsClouds Member Posts: 1,599
    Once one of the rules are activated - disable or switch off the second rule with an attribute change of some kind ?
  • Mile1Mile1 Member Posts: 10
    I can't find any behaviour that will disable other rule when first is activated
Sign In or Register to comment.