Help with a win event.

0 favourites
  • 9 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Hey All, I recently picked up Construct and am having a lot of fun so far, I've made a simple game where your character runs about the screen grabbing coloured keys and unlocking gates at the respective castles. I just can't figure out how to create a win state once all four of my gates are destroyed.

    so far I've created the event that upon the player matching the key to the gate it is then scripted as Destroyed along with that key.

    I have 4 gates labelled Gate_1, Gate_2, Gate_3, Gate_4 what I would like is a scenario such as When all gates destroyed display the "You Win" over the screen, at which point I would just mouse click to play the game again or go to my title screen.

    Any help would be appreciated :)

    Sabs

  • - Group your gates into a family e.g. fam_gates

    - Set a boolean variable for your fam_gates: isDestroyed

    - Add Global variable: countGate

    - Use Pick instance from fam_gates that isDestroyed = 0 with action that countGate = fam_gates.PickedCount

    - If countGate = 0, trigger your win event.

  • Thanks so much, I will give this a go :)

    Sabs

  • Thank for the help, I am not getting this part

    "Use Pick instance from fam_gates that isDestroyed = 0 with action that countGate = fam_gates.PickedCount

    - If countGate = 0, trigger your win event."

    Im not sure what action to do for the countGate part of the example.

    Sorry Im not good with Logic and programming :/

  • Hi,

    You already have the events for when they open the doors

    I think you could just do now:

    Add a Variable "Doors Opened" = 0

    Every time you open the Door

    In a sub-event >>>> Add 1 to doors opened

    "Doors Opened" = Total Doors to open >>>>> Action Game wined etc......

    The total is the doors that you have to open

  • I set my Global Variable like so, however im not sure if this is correct,

    I am not sure of the action, I couldn't find one that seemed to work for the statement, so I typed it in as a script, but no beans.... I Think i need to shelve this project for now and go over some programming and really basic Construct tutorials...

    Thanks for your suggestion Tarek, I couldn't get yours to work either. I think Im a bit too over my head.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are many ways you could do it, Maverick already showed you one-way

    Here is another one very basic see if it helps:

    Capx: https://www.dropbox.com/s/af4qgn59jweg8yi/door%20%26%20key.capx?dl=0

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