How do I make city needs?

  • I want to be able to make city needs, so when there isn't enough water, it would show the percent of people without water on a progress bar. Then, same with food, but I also want a happiness bar. Any ideas for what I could do for the happiness bar? (What makes the people happy)

    Thank you!

    Link to CAPX: https://www.dropbox.com/s/va1sl8r8t4nki4q/TicketToCivilization.capx?dl=0

    I am always open to ideas, so if you have any, tell me!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I haven't looked at your capx yet, but here are some general ideas:

    A progress or percentage bar is always current amount divided by the total. So you'll need to be able to answer the two questions "How many people have water?" and "How many people need water?". One way would be to run a For Each loop, adding 1 to a variable for each object that meets the requirement "Has Water", and then divide that total by the total number of objects that should have water. Same for food.

    For happiness, one way to do it would be to have a similar percentage bar, but count each category of need instead. So if you have two needs, and you only meet one of them, that object would be 1/2 happy. Your happiness amount can change over time instead of being instant if you want to make it more complex.

  • Ok! I will put this into the game and see what happens

    Thank you for the fast response,

    Ryan Kdot

  • You should keep track of non-visual data with instance variables. Your house object can have a variable that keeps track of the population.

    Edit: and your post dissapeared, but I'll leave this here in case you were still interested.

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