Tungstan's Recent Forum Activity

  • Thanks for this, plinkie. I'll check the whole code again and repost this in the forums.

    Cheers!

  • Hey plinkie,

    I have tried this and still is not working as intended.

    everything is working fine until reaching 3 farmers, where it just ignores the event and even if the farmcount is 3 it will still only collect 3 food every 2 seconds...

    image is here: ibb.co/iYKhUx

    I will also load the .capx if it helps... maybe the issue could be somewhere else?

  • Here's another image with the whole function for the "farm"

    ibb.co/fBJE9x

    The function is called when the building is placed on the map. for testing purposes, a building is already placed on the map.

    Essentially I want to have a farm that adds produces food based on how many farmers are working it. In the future I want to add animations for each of the farmers working on the farm, (for each minion destroyed, I can spawn another with the animation set to "farming" at the location of the farm, or can even change the animation of the farm sprite based on this number) but for now I want to make sure the farm is working as intended.

    Any help with this is really appreciated.

    If you have any questions, please let me know! Cheers

  • I have tried

    farmercount = 1, every 2 seconds, add 1 to food

    farmercount = 2, every 2 seconds, add 3 to food

    farmercount = 3, every 3 seconds, add 12 to food

    works fine up until the second event

    farmercount = 3, every 2 seconds, add 5 to food

    but ignores the following "farmercount = 3" event for some reason and only adds 3 food every 2 seconds even when the farm is full (3 farmers). I've tried with else in-between the statements, still not working...

    I don't know much about the "while" loop. any thoughts if that would do the trick? Maybe something like:

    while farm has less than 2 farmers

    farmercount = 1, every 2 seconds, add 1 to food

    farmercount = 2, every 2 seconds, add 5 to food

    while farm has 3 farmers

    farmercount = 3, every 3 seconds, add 12 to food

    I am not sure how to implement this yet, however. would I have to use an "else" between the "while" events? Do I have to check boolean of farm "isFull" instead of checking farmercount? I will try some ideas now, but if any of you guys have an answer, please let me know

    thanks a lot!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the quick answer, plinkie!

    I have not tried it yet like this because I want to later to have 2 farms, for example, and be able to count the farmers for that specific farm (or household eating said food).

    Or is it possible to tie this to a specific instance of a farm? like, for example: if sprFarm.IID then farmercount = 1, every 2 seconds, add 1 to food

    Then again,is it IID or UID I need to look at?

  • Hi guys,

    hope someone can help me with this.

    So basically I have a guy working a farm, producing 1 food ever 2 seconds.

    the way this is set up is basically this: if the farm is empty -> call a function to make minions go to . on collision with it, the minion sprite is destroyed, and a value of 1 is added to farm's instance variable. when the value of 3 is reached, the function changes the behavior of the minions, so they would not be interested in it any longer.

    when the first minion enters the farm, 1 is added to farm's instance variable and also a boolean "isInhabited" set to true.

    the problem is that I have tried to make it so when there is only 1 guy working to add 1 to the global variable "food" ever 2 seconds, when 2 guys are working, i wanted to add 5 to food every 2 seconds or when farm's boolean "isFull" is set to true (meaning 3 farmers), to add 12 to food every 3 seconds.

    don't think i'm skilled enough to think this one through. here's an image with the best idea i've had so far..

    ibb.co/kuoLhH

    hopefully someone can illuminate me!

  • Hi guys,

    hope someone can help me with this.

    So basically I have a guy working a farm, producing 1 food ever 2 seconds.

    the way this is set up is basically this: if the farm is empty -> call a function to make minions go to . on collision with it, the minion sprite is destroyed, and a value of 1 is added to farm's instance variable. when the value of 3 is reached, the function changes the behavior of the minions, so they would not be interested in it any longer.

    when the first minion enters the farm, 1 is added to farm's instance variable and also a boolean "isInhabited" set to true.

    the problem is that I have tried to make it so when there is only 1 guy working to add 1 to the global variable "food" ever 2 seconds, when 2 guys are working, i wanted to add 5 to food every 2 seconds or when farm's boolean "isFull" is set to true (meaning 3 farmers), to add 12 to food every 3 seconds.

    don't think i'm skilled enough to think this one through. here's an image with the best idea i've had so far..

    hopefully someone can illuminate me!

Tungstan's avatar

Tungstan

Member since 18 Mar, 2018

None one is following Tungstan yet!

Trophy Case

  • 6-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

9/44
How to earn trophies