Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
I'm trying to make a game. The player will be able to plant bombs, which blow up a set amount of time (2 seconds) after they are planted. I tried creating a private variable which was set to the TickCount whenever a bomb was created, and an event that constantly checked to see if the tick count had gone 100 above the variable's value (100 ticks 50 fps = 2 sec). However, what happened instead was that all of the bombs planted in the first two seconds of the program running would explode at the same time after 2 seconds had finished. I thus assumed that this was because when you create a private variable, it only has one value for the entire object, rather than each instance of the object having its own value. How do I make a variable for each instance of the Bomb object that the player creates?
Checking the tick count won't work. The reason for that is because every time 100 ticks elapse, all existing bombs will be destroyed at that time. Instead of checking the tick count, set a life variable on the bombs to 200. If the value of the variable is over 0, subtract 100 * TimeDelta from the variable. Then, when the life value is equal/less than 0, destroy the bomb. Here's an example: Time Bombs
Hope this helps.
Well, I already figured out a way to kind of "cheat" at it using the animator. However, I'm sure that will come in handy later---thank you.
Develop games in your browser. Powerful, performant & highly capable.
Okay, I have another question. What does it mean when the application test window suddenly closes? What causes that?
EDIT: Nevermind, I'll make a new post.
EDIT2: Nevermind again, I figured it out