def __init__(self, health, x, y):
     self.health = health
     self.x = x
     self.y = y
     self.background = assets.getImage("graphics/energy_background.png")
     self.foreground = assets.getImage("graphics/energy_bar.png")
     self.bar = self.foreground
     if health is not None:
         self.energy = self.health.health
     else:
         self.energy = 100
Example #2
0
 def __init__(self, scene, name, x, y, **kwargs):
     super(EMT, self).__init__(scene, name, x, y, **kwargs)
     self.sprite = components.StaticSprite(self, assets.getImage("graphics/emt.png"), -32, -14)
     self.glow = components.StaticSprite(self, assets.getImage("graphics/emt_glow.png"), -32, -14)
     self.glow.setVisibility(False)
     # This collider is used to make the EMT solid so the player can stand on it.
     self.collider = components.SpriteCollide(self, -24, 1, 48, 16)
     # Save collider is the area that needs to be touched to activate the EMT
     self.save_collider = components.SpriteCollide(self, -16, -15, 32, 16)
     self.sound = assets.getSound("sounds/save.wav")
     # Don't allow saving until five seconds after the first save or loading
     self.save_delay = 5000
     self.save_timer = self.save_delay
    def __init__(self, scene, name, x, y, mapfile="", spawnpoint="", cavetype="entrance", **kwargs):
        super(Cave, self).__init__(scene, name, x, y, **kwargs)
        self.mapfile = mapfile
        self.spawnpoint = spawnpoint

        if cavetype == "entrance":
            self.sprite = StaticSprite(self, assets.getImage("graphics/cave_entrance.png"), offset_y=-13, layer=0)
        if cavetype == "exit":
            self.sprite = StaticSprite(self, assets.getImage("graphics/cave_exit.png"),  offset_y=-13, layer=0)
        self.collider = SpriteCollide(self, 64, 32, 32, 96)
        if cavetype == "exitinv":
            self.sprite = StaticSprite(self, assets.getImage("graphics/fish.png"),  offset_y=0, layer=0)
        self.collider = SpriteCollide(self, 0, 0, 32, 32)
 def __init__(self, scene, name, x, y, direction=0, **kwargs):
     super(PlayerLaser, self).__init__(scene, name, x, y, **kwargs)
     if direction == -1:
         self.sprite = components.StaticSprite(self, assets.getImage("graphics/laser_l.png"), -4, -3)
         self.speed = -0.5
     else:
         self.sprite = components.StaticSprite(self, assets.getImage("graphics/laser_r.png"), -4, -3)
         self.speed = 0.5
     self.collider = components.SpriteCollide(self, -4, -3, 8, 5)
     self.mapcollider = components.MapCollider(self, scene.tilemap.foreground, -4, -1, 8, 1)
     self.damage_amount = -10
     self.sound = assets.getSound("sounds/laser.wav")
     self.sound.play()
    def __init__(self):
        super(PlayState, self).__init__()
        self.init = True
        self.help_text="""                                  ~yellow~*** HELP ***~white~
In ~yellow~Cat Astro Fee ~white~you play as an astronaut who happens to
also be a cat.  Why is he a cat?  For the pun, of course!
On each planet, he has to collect enough ~yellow~coins ~white~to pay to
get past the ~yellow~space toll booths~white~.

Controls can be configured in ~yellow~data/config.json~white~, but the
default settings are ~yellow~keyboard ~white~with the '~yellow~ARROW KEYS~white~' to move,
'~yellow~Z~white~' to jump, '~yellow~X~white~' to shoot, and '~yellow~ENTER~white~' to pause the game.
~yellow~EMTs~white~ (Emergency Medical Teleporters) are used to save your
progress and act as checkpoints you can respawn at after
losing all your health.
Watch out for enemies, spikes, lava, and other hazards.
If you take damage, a refreshing ~yellow~Fish Soda~white~ refills a
little bit of health.
After collecting all the ~yellow~coins~white~ in the level, return to the
~yellow~space ship~white~ to blast off and head to the next planet!
"""
        self.coins = 0
        self.max_coins = 0
        self.coin_img = assets.getImage("graphics/mini_coin.png")
        self.next_map = None
        self.updateCoins()
        self.scene = None
Example #6
0
 def __init__(self, x, y):
     """User interface for showing and interacting with widgets"""
     # TODO: Change how to select interactive widgets (maybe an interactive list)
     self.x = x
     self.y = y
     self.widgets = []
     self.selected = 0
     self.pointer = assets.getImage("graphics/pointer.png")
    def __init__(self):
        super(TitleState, self).__init__()
        self.image = assets.getImage("graphics/title.png")
        self.ui = ui.UI(435, 380)
        self.ui.add(ui.Button(0, 0, "Continue", self.btnContinue))
        self.ui.add(ui.Button(0, 30, "New Game", self.btnNewGame))
        self.ui.add(ui.Button(0, 60, "Credits", self.btnCredits))
        self.ui.add(ui.Button(0, 90, "Quit", self.btnQuit))

        self.quit = False
 def __init__(self, scene, name, x, y, direction=0, **kwargs):
     super(Ship, self).__init__(scene, name, x, y, **kwargs)
     self.ship_sprite = components.StaticSprite(self, assets.getImage("graphics/ship.png"))
     self.jet_sprite = components.AnimSprite(self, assets.getSpriteAnim("anims/jet.json"), "jet", 16, 122)
     self.collider = components.SpriteCollide(self, 0, 0, self.ship_sprite.rect[2], self.ship_sprite.rect[3])
     self.sound = assets.getSound("sounds/jet.wav")
     self.speed = 0.1
     self.dest_y = y - self.ship_sprite.rect[3] + 17
     self.x = x - self.ship_sprite.rect[2] / 2 + 8
     self.delay = 0
     map = statevars.variables.get("map")
     # Determine if the ship should fly down or already be on the ground when it is created
     if map is not None and map.get("ship_landed") == True:
         self.y = self.dest_y
         self.jet_sprite.setVisibility(False)
     else:
         self.y = -256
         self.sound.play(-1)
     self.state = 0
 def __init__(self, scene, name, x, y, filename="", layer=0, **kwargs):
     super(Image, self).__init__(scene, name, x, y, **kwargs)
     self.sprite = components.StaticSprite(self, assets.getImage(filename), 0, 0, layer)
 def __init__(self):
     super(TitleState, self).__init__()
     self.image = assets.getImage("graphics/title.png")
     self.ui = ui.UI(220, 170)
     self.ui.add(ui.Button(0, 0, "Continue", self.btnContinue))
     self.ui.add(ui.Button(0, 20, "New Game", self.btnNewGame))
 def __init__(self, x, y, filename):
     super(Image, self).__init__(x,y)
     self.image = assets.getImage(filename)
 def __init__(self):
     super(PauseState, self).__init__()
     self.old_state_name = ""
     self.old_state = None
     self.image = assets.getImage("graphics/pause.png")
 def __init__(self, scene, name, x, y, filename="", **kwargs):
     super(Sign, self).__init__(scene, name, x, y, **kwargs)
     self.sprite = StaticSprite(self, assets.getImage("graphics/sign.png"), layer=0)
     self.collider = SpriteCollide(self, 16, 0, 32, 64)
     self.filename = filename
Example #14
0
 def __init__(self, scene, name, x, y, **kwargs):
     super(Energy, self).__init__(scene, name, x, y, **kwargs)
     self.sprite = components.StaticSprite(self, assets.getImage("graphics/fish.png"))
     self.collider = components.SpriteCollide(self, 0, 0, 16, 16)
     self.health_amount = 25
     self.sound = assets.getSound("sounds/energy.wav")