Toggle script
-
This is my attempt at a script that toggles between 1 and 0 when a is pressed.'toggle' is the output value, and can be either 0.0 or 1.0. 'allow_repeat' is intended to stop the script from excecuting again until a is released. The frame detector is just to stop 'toggle' being re-declared as 0.0 every time the script restarts. In sketchyphysics, it just acts like a is the controller.
if(frame<5);toggle=0.0;elsif(a==0.0);allow_repeat=1.0;elsif(allow_repeat==0.0);toggle;elsif(a==0.0);toggle;elsif(toggle==0.0);allow_repeat=0.0;toggle=1.0;else;allow_repeat=0.0;toggle=0.0;end
Can anyone help?? Is there a proper way of doing this (mine seems overly complicated)??
-
Does that work?
I don't think it would. The problem is the toggle and allow_repeat are not saved from one frame to the next.
-
Ohhhh... I was assuming they would be. Maybe something for a future release?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement