def action_plantButton1(): global buttonRestaurant1_Pressed,restaurant1,money buttonRestaurant1_Pressed = True restaurant1.append(restaurants('models/plant/plants3.egg')) #restaurant1[len(restaurant1)-1].model = (loader.loadModel('models/restaurant1/tetris-building.egg')) restaurant1[len(restaurant1)-1].capacity = 1 restaurant1[len(restaurant1)-1].fRValue = .01 restaurant1[len(restaurant1)-1].eRValue = .1 restaurant1[len(restaurant1)-1].cost = 10 restaurant1[len(restaurant1)-1].type='environment' restaurant1[len(restaurant1)-1].model.reparentTo(render) restaurant1[len(restaurant1)-1].model.setScale(0.5) setMoney( getMoney() - restaurant1[len(restaurant1)-1].cost) showMoneyValue(getMoney()) setEnvironmentRating(getEnvironmentRating() + 0.1) showEnvironmentRating(getEnvironmentRating()) restaurant1[len(restaurant1)-1].model.setPos(0,0,100) taskMgr.add(moveRestaurant1,'moveRestaurant1') startMouseFunctionRestaurant1 = mouseFunctionalityButtons()
def updateEnvironmentRating_1(task): setEnvironmentRating(updateEnvironmentRating()) showEnvironmentRating(getEnvironmentRating()) updateCityRating() return task.again
def initializeGameControls(task): global showMoneyValue,showCityRating,showDevelopmentRating,showHappinessRating, showEnvironmentRating, showNoOfCitizens, showMessage setCityRating(0) setEnvironmentRating(0) setDevelopmentRating(0) setHappinessRating(0) setNumberOfCitizens(0) setMoney(10000) showCityRating(getCityRating()) showDevelopmentRating(getDevelopmentRating()) showHappinessRating(getHappinessRating()) showEnvironmentRating(getEnvironmentRating()) showNoOfCitizens(getNumberOfCitizens()) showMoneyValue(getMoney()) showMessage('Welcome to my game! Your target is to achieve a city rating of 5 by the end of December','white') return task.done
def producePeople_backbone(task): global peopleList, interval, entranceFees, eRStepSize actorType = random.randint(1,3) if actorType == 1: peopleList.append(Actor('models/ralph',{'walk':'models/ralph-walk'})) peopleList[len(peopleList)-1].setScale(5) elif actorType ==2: peopleList.append(Actor('models/eve/eve',{'walk':'models/eve/eve-walk'})) peopleList[len(peopleList)-1].setScale(5) elif actorType ==3: peopleList.append(Actor('models/nik-dragon',{'walk':'models/nik-dragon'})) peopleList[len(peopleList)-1].setScale(1.5) peopleList[len(peopleList)-1].setHpr(90,0,0) peopleList[len(peopleList)-1].loop('walk') peopleList[len(peopleList) - 1].reparentTo(render) wander(peopleList[len(peopleList)-1],Point3(-500,0,10)) # update the environment Rating of the city setEnvironmentRating(getEnvironmentRating() - eRStepSize) showEnvironmentRating(getEnvironmentRating()) # update the correspoding cityRating setCityRating((getEnvironmentRating() + getDevelopmentRating() + getHappinessRating())/3) showCityRating(getCityRating()) # intimate game control to increase the total money setMoney(getMoney() + entranceFees) showMoneyValue(getMoney()) # show the number of citizens on the screen showNoOfCitizens(len(peopleList)) return task.again