How to end the game?
sheisey

I created a standard hidden object game with a few added features.  Is there a way that when all the hidden objects have been clicked, the game will end?

 

http://hmatest1.com//echologics-game-testing/index.html

All 6 Comments
Gio

Hi and welcome to the forums

 

Firstly, it's a nice idea for a game, I like the timing element. There are several ways of doing that, and which one is best depends on what you want to do with your game (like, will that be the only level, or will there be more levels? etc).

 

You could do this (I'm assuming you're using the editor):

 

  1. For every "hidden object" in the scene, add a property to it, to mark it as an object that the player has to find (see the picture below, I'm setting a flag called "objectToFind").

    hogprop1.png

    hogprop2.png
     
  2. In hiddenObject.js, at the bottom of the onMoveComplete function (after removing the object), add this code to look for any objects that have that flag. If there are no more objects with that flag in the scene, the game is over:
    if (!wade.getSceneObjects('objectToFind', true).length){    // game is over, do something here    wade.clearScene();    wade.loadScene('gameOver.wsc'); // you'll need to create a game over scene}

    I hope this helps, let us know how you get on

sheisey

Thank you so much for your response!  I took a slightly different direction using the tutorial here: https://youtu.be/AUvhfrTktvQ

 

Everything seems to work great, but it doesn't appear to be working on mobile or in Firefox, so I am now trying to figure that out...

 

Check it out!

 

http://hmatest1.com//echologics-game-v2/index.html

Gio

Hi

 

Your object called "leak1" seems to have a sprite with negative width. Firefox doesn't like this.

jota

hi

 

I Tried to implement the"game over" feature, but right after appending the property "objectToFind" it is not possible to click on the cats anymore. even if i remove the property.

Gio

Do you still have AutoListen selected?

jota
didn't notice that, sure solves it :)
Post a reply
Add Attachment
Submit Reply
Login to Reply