def __init__(self, x, y, level, screen, dashboard, sound, gravity=0.75): super(Mario, self).__init__(x, y, gravity) self.spriteCollection = Sprites().spriteCollection self.camera = Camera(self.rect, self) self.sound = sound self.input = Input(self) self.inAir = False self.inJump = False self.animation = Animation( [ self.spriteCollection["mario_run1"].image, self.spriteCollection["mario_run2"].image, self.spriteCollection["mario_run3"].image, ], self.spriteCollection["mario_idle"].image, self.spriteCollection["mario_jump"].image, ) self.traits = { "jumpTrait": jumpTrait(self), "goTrait": goTrait(self.animation, screen, self.camera, self), "bounceTrait": bounceTrait(self), } self.levelObj = level self.collision = Collider(self, level) self.screen = screen self.EntityCollider = EntityCollider(self) self.dashboard = dashboard self.restart = False self.pause = False self.pauseObj = Pause(screen, self, dashboard)
def __init__(self, screen, x, y, color): # Super initializer super(Object, self).__init__(x, y) # Input class instance self.input = Input(self) self.screen = screen self.color = color self.speed = 0 # Traits self.traits = {"goTrait": goTrait(self.screen, self, self.speed)}
def __init__(self, speed, screen, x, y): # Super initializer super(Player, self).__init__(x, y) # Properties # Input class instance self.input = Input(self) self.screen = screen self.speed = speed # Traits self.traits = {"goTrait": goTrait(self.screen, self, self.speed)}
def __init__(self, screen, x, y): # Super initializer super(Background, self).__init__(x, y) # Input class instance self.input = Input(self) # Properties self.img = pygame.transform.rotozoom( pygame.image.load("imgs\grass2.png"), 0, 10) self.screen = screen self.speed = 0 # Traits self.traits = {"goTrait": goTrait(self.screen, self, self.speed)}
def __init__(self, x, y, level, screen, dashboard, sound, gravity=0.75): super(Mario, self).__init__(x, y, gravity) self.x = x self.spriteCollection = Sprites().spriteCollection self.CT = CollisionTester() self.camera = Camera(self.rect, self) self.sound = sound self.level = level self.OI = Input(self) self.closest_mob = None self.closest_object = None self.output =0 self.inAir = False self.brain = Model().share_memory() self.fitness = 0 self.animation = Animation( [ self.spriteCollection["mario_run1"].image, self.spriteCollection["mario_run2"].image, self.spriteCollection["mario_run3"].image, ], self.spriteCollection["mario_idle"].image, self.spriteCollection["mario_jump"].image, ) self.traits = { "jumpTrait": jumpTrait(self), "goTrait": goTrait(self.animation, screen, self.camera, self), "bounceTrait": bounceTrait(self), } self.levelObj = level self.collision = Collider(self, level) self.screen = screen self.EntityCollider = EntityCollider(self) self.dashboard = dashboard self.restart = False self.pause = False self.pauseObj = Pause(screen, self, dashboard)
def __init__(self, x, y, level, screen, dashboard, gravity=1.25): super(Mario, self).__init__(x, y, gravity) self.spriteCollection = Sprites().spriteCollection self.camera = Camera(self.rect, self) self.sound = Sound() self.animation = Animation([ self.spriteCollection["mario_run1"].image, self.spriteCollection["mario_run2"].image, self.spriteCollection["mario_run3"].image ], self.spriteCollection["mario_idle"].image, self.spriteCollection["mario_jump"].image) self.traits = { "jumpTrait": jumpTrait(self), "goTrait": goTrait(self.animation, screen, self.camera, self), "bounceTrait": bounceTrait(self) } self.levelObj = level self.collision = Collider(self, level) self.screen = screen self.EntityCollider = EntityCollider(self) self.dashboard = dashboard self.restart = False