Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    def __init__(self, x, y, level, gravity=1.25):
        super(MarioHeadless, self).__init__(x, y, gravity)
        self.input = Input(self)

        self.traits = {
            "jumpTrait": jumpTrait(self),
            "goTrait": goTraitHeadless(self),
            "bounceTrait": bounceTrait(self)
        }

        self.levelObj = level
        self.collision = Collider(self, level)
        self.EntityCollider = EntityCollider(self)
        self.restart = False
Exemplo n.º 3
0
 def __init__(self, screen, spriteColl, x, y, level, sound):
     super(RedMushroom, self).__init__(y, x - 1, 1.25)
     self.spriteCollection = spriteColl
     self.animation = Animation([
         self.spriteCollection.get("mushroom").image,
     ])
     self.screen = screen
     self.leftrightTrait = LeftRightWalkTrait(self, level)
     self.type = "Mob"
     self.dashboard = level.dashboard
     self.collision = Collider(self, level)
     self.EntityCollider = EntityCollider(self)
     self.levelObj = level
     self.sound = sound
Exemplo n.º 4
0
 def __init__(self, screen, spriteColl, x, y, level):
     super(Koopa, self).__init__(y - 1, x, 1.25)
     self.spriteCollection = spriteColl
     self.animation = Animation([
         self.spriteCollection.get("koopa-1").image,
         self.spriteCollection.get("koopa-2").image,
     ])
     self.screen = screen
     self.leftrightTrait = LeftRightWalkTrait(self, level)
     self.timer = 0
     self.timeAfterDeath = 35
     self.type = "Mob"
     self.dashboard = level.dashboard
     self.collision = Collider(self, level)
     self.EntityCollider = EntityCollider(self)
     self.levelObj = level
Exemplo n.º 5
0
    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)
Exemplo n.º 6
0
    def __init__(self, x, y, level, screen, dashboard, sound, gravity=0.75):
        super(Mario, self).__init__(x, y, gravity)
        self.camera = Camera(self.rect, self)
        self.sound = sound
        self.input = Input(self)
        self.inAir = False
        self.inJump = False
        self.powerUpState = 0
        self.invincibilityFrames = 0
        self.traits = {
            "jumpTrait": JumpTrait(self),
            "goTrait": GoTrait(smallAnimation, 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)
Exemplo n.º 7
0
    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
Exemplo n.º 8
0
 def __init__(self):
     self.rect = None
     self.EC = EntityCollider(self)
     self.vel = vec2D()