Disabling An Actor's Behavior Until Hitting Another Actor

daniel.robert.campbelldaniel.robert.campbell Member Posts: 251
edited November -1 in Working with GS (Mac)
I'm having an issue. I'm trying get a ball's function to be disabled until hitting another actor.

How I want the ball to behave:

The ball is placed at the top of the screen. When the mouse button is pressed, I want it to launch at the crosshairs I have. I want the ball to then freely bounce around the level until it reaches the bottom. Upon reaching the bottom, the ball will respawn at the top to start it all over again.

How things are going wrong:

Alright, everything works fine as described above. The problem is that if the player presses the mouse button while the ball is bouncing around, it will cause the ball to move again. I'd rather the player have NO control of the ball until it respawns at the top.

Any help would be greatly appreciated.

Comments

  • ToastKittenToastKitten Member Posts: 360
    make a boolean variable "mousePresed" and set it to false.

    wherever your condition is that checks for when the mouse is pressed, add another condition if attribute self.mousePressed is false

    inside that rule, immediately change the attribute mousePressed to true

    Let me know if this helps!
  • Awesome. Thanks guys. No offense ToastKitten but I went ahead and tried Tshirtbooth's suggestion first and it worked great. Thanks again yall!
Sign In or Register to comment.