kelvindavies11 Posted September 3, 2014 Share Posted September 3, 2014 Hi guys and girls,I am creating a 2d sim tower type game and have a question relating to points and scoring engine. Scenario: bedroom will generate 2 people entertainment room will consume 2 people for entertainment and one for work work will consume 2 people for work I am look for some help in generating a algorithm which identifies if I have enough people for entertainment/work. Any help appreciated. At the moment i have: Required bedroom= (entertainment+work )-people; Required work = (people/2)- work Required entertainment = (people/2)- entertainment Thank you guys,Kelvin Quote Link to comment Share on other sites More sharing options...
Deban Posted September 4, 2014 Share Posted September 4, 2014 How about plus and minus?var availablePeople = 0;When a room is created:availablePeople += 2;You can give each room a requirement of necessary free/available people to be created. Bedrooms have 0 as requirement for example.And then a room can generate/consume people.function OnCreation() { availablePeople += this.peopleGenerated;}function OnDestruction() { availablePeople -= this.peopleGenerated;}It's consumed if peopleGenerated is negative. If you have different pools of people to consume, create different variables. Treat it like resources, mana or gold. Quote Link to comment Share on other sites More sharing options...
kelvindavies11 Posted September 5, 2014 Author Share Posted September 5, 2014 Great reply, it is supprising how you get caught up in the moment and you forget the straight forward answer :-) Hopefully I will get a demo up and running before the end of the night :-) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.