Accelerate behavior trouble

MrSKYoneMrSKYone Member Posts: 26
edited July 2012 in Working with GS (Mac)
Hi to you all,

Im currently working on doing a project where a projectile is throw in a X angle with Y velocity.

My set up is the following:

- if Mouse button down
- and mouse.position.y > self.position.y (projectile)
==> accelerate 90(up) relative to scene
==> Speed = magnitude between mouse position y and self position y

- if Mouse button down
- and mouse.position.y < self.position.y
==> accelerate 270(down) relative to scene
==> Speed = magnitude between mouse position y and self position y

Previously, I had split the screen into two (landscape) and when the mouse down was > to 160y the projectile was going down, and when it was < to 160y, the projectile was going up (it worked perfectly)
I decided to change to make the ball become the reference point. However my actual set up isn't working and I don't know why. My actual result is that the projectile is always accelerating in the same direction, whatever the mouse position and self position are.

Any advices? Thank a lot.

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi, try putting the 2nd half of your Rules in the Otherwise section, see if that get's the result you're after:

    Rule: if Mouse button down

    Rule (nested in the top one: if mouse.position.y > self.position.y (projectile)
    ==> accelerate 90(up) relative to scene
    ==> Speed = magnitude between mouse position y and self position y

    otherwise

    ==> accelerate 270(down) relative to scene
    ==> Speed = magnitude between mouse position y and self position y

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

Sign In or Register to comment.