How do I set up a simple job assignment interface?

0 favourites
  • 3 posts
From the Asset Store
Give your players the chance to choose their own keys or buttons!
  • Hello all, I am trying to create a touch game in which touching/clicking on various open job location sprites will assign a worker to that location. The job sprite instances have a boolean instance variable called Occupied. When the player clicks on an Un-Occupied job, it will become Occupied and change animation frames to show that the empty space is now occupied. The player only has 4 workers to use to assign to any of the 6 jobs, so I have a Global variable called JobsAssigned which keeps track of the number of workers assigned and that updates the WorkerCounter sprite to show the player how many workers he still has available.

    I have this part working but I also want the player to be able to unassign a worker from a job and have the WorkerCounter and JobsAssigned update as expected.

    I have tried this a bunch of ways and I think I may not fully understand how the touch object works or how sub-events resolve themselves. And yes, I have read the manual entries. <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink"> Please help!

    The .capx is attached but you can also download it here: https://dl.dropboxusercontent.com/u/636 ... eeded.capx

    Thanks for any guidance or corrected .capx you can provide.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here is your file edited. This is what I did to make it work:

    1 - removed the "not occupied" condition and set it to an else event. This means anytime the previous event fails, the else triggers.

    2 - As a bonus, I combined all 4 of your set worker animation events into a single event.

    Hope that gets you what you need and good luck with your project.

    p.s. I didn't really look too hard into why the "not occupied" event failed.

  • THANK YOU FRAGFATHER!!!!!! I have been stuck on this for days and I'm trying to make something for the Newgrounds Future 2030 game jam. Thanks for the extra event saving tips too! This C2 community has the best people in it!

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