"Stuck" detection

TheBasedAbel

  • Posts: 24
im trying to create a bit of code that i can attach to the ball of a pinball game so that if the ball is stuck somewhere it will nudge itself in a direction to enable play to continue, I think this is the bit of the code i'm having trouble with, i want to detect that the ball hasn't been moving for about 3 seconds and if it hasn't. make it nudge itself left/right gently.

dtrungle

  • Posts: 1938
I don't think the speed will ever be equal to zero. Try making it -1<x<1. You can also try using x/y position instead of speed.

You should not use a timer inside the Always Event without first adding a one-time switch mechanic, such as a boolean flag.

TheBasedAbel

  • Posts: 24
this is what i came up with based on that feedback and still no results? I tried making the window of the parameters larger to see if that was the thing that wasnt being detected but no avail

dtrungle

  • Posts: 1938
After the boolean=true check, set it back to false. In the same area, add a print command so you know that it was flagged.

If there is no console print then increase the numbers some more, or implement the x/y point method. You can create a do every timer that prints out the x/y speed so you know what the speed is.

TheBasedAbel

  • Posts: 24
wow that's a great idea I can't believe I never thought of using print to check parameters, thanks a million lol. Love the stencyl forums.  :D