Having troubles with Variables that change with on Keypress

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi, first, sorry about the english. Its not my native language.

    This snipped code is for a mini tower defense game that uses cameras and energy. What Im trying to do is "when I press 2" and "camera 2 is on", set the camera sprite opacity to 0, and gains 8 energy back. When the camera is off, It turn it back to opacity 100/or the value of the Cam1 (that lowers with power). But I cant see it working. All the cameras can be turned down, but not up.

    I cant see what I´m missing. If anyone can help, I´ll be glad.

  • It's the classic, where the variable toggles on and off in the same tick, so both of the events are true. It happens so fast that you don't see it. Usual fix I think is to make it an Else statement.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • T.hanks, I was wondering if wasnt it the problem, and I really forgot the else statement.

    Thank you very much, it worked perfectly

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)