Announcement

Collapse
No announcement yet.

How to deny a key press after a certain event has happened?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to deny a key press after a certain event has happened?

    I have a flash light working with a decay rate. You press F once to turn it on and a sound plays, press again to turn off and sound plays. After the power value reaches 0 it shorts out and a sound plays BUT you can still press F and the sound still plays. How would i make it so sound no longer plays when power is at 0? I have been messing around myself but have not come up with the result i need.

    #2
    Add a Boolean that is set the first time the button is pressed (e.g. isFlashlightOn) ... have this set to false when it shorts out. Now on Key Press ... check the Boolean ... if it is off then perform normal step ... if it is set, ignore it.
    Quinton Delpeche
    Founder - Gobbo Games | Designer - The Colony 2174 (Board Game) | Developer - Riders of Asgard

    Comment


      #3
      Originally posted by qdelpeche View Post
      Add a Boolean that is set the first time the button is pressed (e.g. isFlashlightOn) ... have this set to false when it shorts out. Now on Key Press ... check the Boolean ... if it is off then perform normal step ... if it is set, ignore it.
      Sorry for grave digging this post but how would I ignore it?

      I have this but im not sure what to put at true to make it ignore the key press
      Click image for larger version

Name:	xRr2YFh.png
Views:	1
Size:	44.0 KB
ID:	1074659

      Comment


        #4
        Click image for larger version

Name:	FL.jpg
Views:	1
Size:	90.6 KB
ID:	1074664

        This way you can't turn the flashlight on if it's battery is depleted.

        Comment

        Working...
        X