What does this mean for me? You will always be able to play your favorite games on Kongregate. However, certain site features may suddenly stop working and leave you with a severely degraded experience.
What should I do? We strongly urge all our users to upgrade to modern browsers for a better experience and improved security.
We suggest you install the latest version of one of these browsers:
Kongregate is a community-driven browser games portal with an open platform for all web games.
Get your games in front of thousands of users while monetizing through ads and virtual goods.
Learn more »
Ok, I’m probably just missing out on some obvious programming method, but I’ve been stuck on this for a bit and I need to ask for some help.
Basically, I’m creating a puzzle game. I have a class that I’ve defined that is the puzzle itself. From my main game, I can call initPuzzle(args) and have a puzzle start up.
My problem is figuring out how to either return success/failure from the puzzle object or in some other way notify the main game that the puzzle has completed.
The initPuzzle function simply sets up the puzzle with appropriate parameters – it is a void function and I don’t think there’s any way to return from it since I have other functions checking the puzzle constantly to see if it has been completed or not.
For this particular issue, I want to be able to call as series of puzzles in a row and time the performance across all of them. This requires my main game to know when the puzzle has finished so we can create a new one.
Does any of this make sense? Am I missing something obvious? Thanks in advance for the help!
There’s a few ways to go about it.
When you set up your puzzle, you can pass it a reference to the main game. Then when its finished, it calls some method in main game to let it know the puzzle is finished. Clean and easy.
or, just pass it a reference to a function instead, that it can call when it’s finished. More versatile, but you need to be careful about scope.
or, what I like to do is set up a static reference to the main game, so the puzzle, or anything else, can access methods of the main game at any time. I guess it’s pretty bad style really, but it’s convenient.