示例#1
0
 def start_game(self):
     stellar.log("Start button pressed")
     stellar.log("Starting music")
     resources.AUDIO_MAIN.looping = True
     resources.AUDIO_MAIN.play()
     resources.AUDIO_MAIN.set_volume(0.6)
     self.set_room("room_game")
示例#2
0
    def __init__(self, sx, sy, target):
        tools.GameObject.__init__(self)

        stellar.log("Bullet shot from (%s, %s)" % (sx, sy))

        self.start_x = sx
        self.start_y = sy
        self.target_x, self.target_y = target

        self.speed = 30
        self.lifespan = 1000
        self.age = 0

        self.move_to(self.start_x, self.start_y)

        self.add_sprite("default", resources.BULLET)
        self.set_sprite("default")

        steps_number = max(abs(self.target_x - self.start_x),
                           abs(self.target_y - self.start_y))

        self.ostepx = float(self.target_x - self.start_x) / steps_number
        self.ostepy = float(self.target_y - self.start_y) / steps_number

        self.move_by(0, -25)
        self.move_by(self.ostepx * 50, self.ostepy * 50)
示例#3
0
    def __init__(self):
        stellar.base.Base.__init__(self)
        self.title = "The Man With No Nametag"
        self.size = resources.GAME_SIZE

        self.debug = True

        self.target_framerate = 60

        self.add_room("room_menu", room_menu.Room())
        self.add_room("room_game", room_game.Room())

        self.set_room("room_menu")

        stellar.log("Game initialised")
示例#4
0
 def on_stop(self):
     stellar.log("Game stopped")
示例#5
0
 def on_start(self):
     stellar.log("Game started")
示例#6
0
import stellar
import tools
import os

stellar.log("Loading resources")

TILESIZE = 64
LEFTY_SCALE = 2.0
ZOMBIE_SCALE = 2.0

GAME_SIZE = (1300, 800)

CONTROL_UP = stellar.keys.K_w
CONTROL_DOWN = stellar.keys.K_s
CONTROL_LEFT = stellar.keys.K_a
CONTROL_RIGHT = stellar.keys.K_d

FONT_ARIAL_WHITE_30 = stellar.tools.Font("resources/fonts/arial.ttf", 30, (255, 255, 255))
FONT_ARIAL_WHITE_12 = stellar.tools.Font("resources/fonts/arial.ttf", 12, (255, 255, 255))
FONT_WESTERN_WHITE_30 = stellar.tools.Font("resources/fonts/Pixel-Western.ttf", 30, (255, 255, 255))

AUDIO_ZOMBIE_HIT_SQUAD = stellar.sound.Music("resources/audio/Zombie_Hit_Squad.mp3")
AUDIO_MAIN = stellar.sound.Music("resources/audio/No_Nametag_Final_Maybe.mp3")
AUDIO_GUNSHOT = stellar.sound.Effect("resources/audio/GUN-Shot.wav")
AUDIO_HOVER_CLICK = stellar.sound.Effect("resources/audio/click.wav")
AUDIO_PRESS_CLICK = stellar.sound.Effect("resources/audio/click4.wav")

LEVEL_TEST = tools.legacy_parse_level("resources/levels/beersy.lvl")
LEVEL = tools.parse_level("resources/levels/final.lvl")

TILE_FILENAMES = os.listdir("resources/images/tiles/")
示例#7
0
 def kill(self, reason="unspecified"):
     stellar.log("Bullet killed, reason: %s" % reason)
     self.disable()
示例#8
0
 def shot(self):
     self.health -= 1
     if self.health:
         stellar.log("Zombie got shot, %s health remaining" % self.health)
     else:
         self.kill(reason="shot")
示例#9
0
 def kill(self, reason="unspecified"):
     self.room.zombies.remove(self)
     self.room.game_objects.remove(self)
     stellar.log("Zombie died, reason: %s" % reason)
     self.disable()