@property def Surface(self): return self.surfEntity @property def GameSurface(self): return self.surfGameDisplay if __name__ == "__main__": from src.controllers.frogcontroller import FrogController from src.core.validationframework import ValidationFramework Validation = ValidationFramework() # Draw entities ... do stuff that needs to be rendered to the Main Display entTruck = TruckEntity([0, 0]) truckControl = FrogController(entTruck) entTruck.setController(truckControl) entTruck.setGameScreen(Validation.Surface) Validation.addToRunQueue(entTruck.update) while Validation.running == True: for event in Validation.getEvents(): Validation.run() entTruck.respond(event) Validation.quit()
return self.engDisplay.Surface @property def image(self): """ These are used by pygame and are necessary in order for the parent object (DirtySprite) """ return self.Surface if __name__ == "__main__": from src.controllers.frogcontroller import FrogController from src.core.validationframework import ValidationFramework Validation = ValidationFramework() # Draw entities ... do stuff that needs to be rendered to the Main Display entCar = CarEntity([0, 0]) carControl = FrogController(entCar) entCar.setController(carControl) entCar.setGameScreen(Validation.Surface) Validation.addToRunQueue(entCar.update) while Validation.running == True: for event in Validation.getEvents(): Validation.run() entCar.respond(event) Validation.quit()
Validation = ValidationFramework() # Create a new EntityFactory defaultEntityFactory = EntityFactory(Validation.engDisplay) # Draw entities ... do stuff that needs to be rendered to the Main Display # Create Static Entities (i.e. visual aspects of the Game Screen) listStaticBackgroundEntities = defaultEntityFactory.buildBackground() # Create Controlled Entities (i.e. those Entities that will be controllable via User Input) entFrog = defaultEntityFactory.buildFrog() entFrog.draw() # Add each of the update methods of the static entites to the run queue for staticEntity in listStaticBackgroundEntities: Validation.addToRunQueue(staticEntity.update) Validation.addToRunQueue(entFrog.update) while Validation.running == True: for event in Validation.getEvents(): Validation.run() entFrog.respond(event) Validation.quit()