Esempio n. 1
0
 def _play(self):
     self.is_playing_var = True
     self._music_picker.is_enabled_var = False
     self._play_button.is_enabled_var = False
     self._stop_button.is_enabled_var = True
     self._loop_button.is_enabled_var = False
     pyxel.playm(self.music_no_var, loop=self.should_loop_var)
Esempio n. 2
0
 def update_respect(self):
     '''
     ヘンク・B・ロジャースへの敬意
     '''
     if self.tick - 1 == len(self.TEXTCOLOR):
         self.state = self.STATE_STORY
         pyxel.playm(1)
Esempio n. 3
0
    def display(self):
        global MUSIC, IS_MODE_TERMINATE, TEMP_FRAMES
        # ----- Opening credit.
        if pyxel.frame_count < 51:
            self.Text.display(self.Text.font, 30, 128, "Created by\nNaoki\nin 2019.")
            if MUSIC != 0:
                MUSIC = 0
                pyxel.play(0,5, loop=False)
                pyxel.play(1,7, loop=False)
        if pyxel.frame_count > 17:
            pyxel.pal(7,6)
        if pyxel.frame_count > 34:
            pyxel.pal(7,5)
        if pyxel.frame_count > 52:
            pyxel.pal()

        # ----- Opening scene.
        if pyxel.frame_count >= 68 and TEMP_FRAMES == 0:
            self.Text.display(self.Text.font, 100, 128, "はじめから\nつづきから".strip())
            
            if MUSIC != 1:
                MUSIC = 1
                pyxel.playm(MUSIC, loop=True)
            
            if pyxel.btn(pyxel.KEY_SPACE):
                IS_MODE_TERMINATE =1
Esempio n. 4
0
 def display(self):
     global MUSIC
     if MUSIC != 3:
         pyxel.stop()
         MUSIC = 3
         pyxel.playm(MUSIC, loop=True)
     
     if (CURRENT_REALM == DEVA_REALM):
         tm, u, v, w, h = 0, 0, 0, MAP_SIZE_X, MAP_SIZE_Y
         pyxel.pal(11,7)
     elif (CURRENT_REALM == MANUSSA_REALM):
         tm, u, v, w, h = 0, 0, 0, MAP_SIZE_X, MAP_SIZE_Y
         pyxel.pal()
     elif (CURRENT_REALM == TIRAACCHANA_REALM):
         tm, u, v, w, h = 0, 0, 0, MAP_SIZE_X, MAP_SIZE_Y
         pyxel.pal(11,10)
     elif (CURRENT_REALM == PETA_REALM):
         tm, u, v, w, h = 0, 0, 0, MAP_SIZE_X, MAP_SIZE_Y
         pyxel.pal(11,8)
     elif (CURRENT_REALM == NIRAYA_REALM):
         tm, u, v, w, h = 0, 0, 0, MAP_SIZE_X, MAP_SIZE_Y
         pyxel.pal(11,5)
     # 指定したtm(template)番号の(u,v)座標から
     # サイズ(w,h)の大きさを(base_x,base_y)座標に描画する
     pyxel.bltm(self.base_x,self.base_y,tm,u,v,w,h)
Esempio n. 5
0
 def __init__(self):
     pyxel.init(192, 128, scale=8, caption="NIBBLES", fps=60)
     pyxel.load("assets/resources.pyxres")
     self.current_game_state = GameState.RUNNING
     self.level = Level()
     self.hud = Hud()
     self.apple = Apple(64, 32)
     self.snake = []  # Store the snake section
     self.snake.append(SnakeSection(32, 32, is_head=True))
     self.snake.append(SnakeSection(24, 32))
     self.snake.append(SnakeSection(16, 32))
     self.snake_direction = Direction.RIGHT
     self.sections_to_add = 0
     self.speed = 1.5
     self.time_last_frame = time.time()
     self.dt = 0
     self.time_since_last_move = 0
     self.score = 0
     self.apples_eaten_this_level = 0
     self.apples_eaten_total = 0
     self.current_level = 1
     self.input_queue = collections.deque(
     )  # Store the direction changes so the player can easily chain them
     self.play_music = True
     if self.play_music:
         pyxel.playm(0, loop=True)  # Play music track 0
     pyxel.run(self.update, self.draw)
Esempio n. 6
0
 def __init__(self):
     global g_player
     g_player = Charactor(g_player.name, 13, 2, 13, 2, [], [], 10, 0, 7)
     g_player.maxhp, g_player.maxmp, g_player.spells, g_player.agility = Statuses[
         0]
     g_player.hp, g_player.mp = g_player.maxhp, g_player.maxmp
     pyxel.playm(0, loop=True)
    def __init__(self):
        pyxel.init(160, 120, caption="Pyxel Jump")

        pyxel.load("assets/backpack.pyxres")
        self.score = 0
        self.player_x = 72
        self.player_y = -16
        self.player_vy = 0
        self.player_is_alive = True

        self.far_cloud = [(-10, 75), (40, 65), (90, 60)]
        self.near_cloud = [(10, 25), (70, 35), (120, 15)]
        self.floor = [(i * 60, randint(8, 104), True) for i in range(4)]
        self.fruit = [(i * 60, randint(0, 104), randint(0, 2), True)
                      for i in range(4)]

        pyxel.playm(0, loop=True)

        a = "c3d2e2b3 a2b2c3b2"
        b = "c3d2e2a3 a2b2c3a2"
        pyxel.sound(0).set(a * 3 + b * 1, "t", "2", "nf", 30)
        pyxel.sound(1).set("a1b1b1a1", "p", "2", "nf", 120)

        #pyxel.play(0, 0, loop=True)
        #pyxel.play(1, 1, loop=True)

        pyxel.sound(2).set("c3g3c4g3", "p", "1", "nf", 150)
        pyxel.sound(3).set("c1d1e1d1 c2d2e2a1", "t", "2", "nf", 100)  # 階段
        pyxel.play(2, 2, loop=True)
        pyxel.play(3, 3, loop=True)

        pyxel.run(self.update, self.draw)
Esempio n. 8
0
    def update_title(self):
        key = button_pressed()
        if self.is_instructions and key != None:
            self.is_instructions = False
            return

        if key != None:
            self.key_used = key

        if self.key_used != None and not self.is_instructions:
            self.key_timer += 1

            if self.key_timer > 30:
                if self.menu_option == 0:
                    self.update_state = self.update_game
                    self.draw_state = self.draw_game
                    pyxel.playm(0, loop=True)

                elif self.menu_option == 1:
                    self.is_instructions = True
                self.key_timer = 0
                pyxel.play(0, 7)

            if button_released(self.key_used):
                self.key_used = None
                if self.key_timer <= 30:
                    self.menu_option = (self.menu_option + 1) % 2
                    pyxel.play(0, 10)
                    self.key_timer = 0
Esempio n. 9
0
    def __init__(self):
        '''
		Definimos el constructor
		'''

        # construimos la ventana
        pyxel.init(constants.ventana_x,
                   constants.ventana_y,
                   caption='Peach dk game')

        # Load varibles
        pyxel.load('./assets/characters.pyxres')
        self._score = 0
        self._Barriles = []
        self._Peach = Peach()  # el objeto mario funcional
        self._vidas = self._Peach.get_lives()
        self._posiciones_escaleras = []
        self._animation = 0
        self._h_suelo = []
        self._win = False

        # ponemos la musica
        pyxel.playm(0, loop=True)

        # empezamos a correr el juego
        pyxel.run(self.update, self.draw)
Esempio n. 10
0
    def __init__(self):
        # make window
        pyxel.init(128, 128, caption="cat game")
        # load picture data.
        pyxel.load("pictures.pyxres")
        # init direction
        self.direction = RIGHT
        # Score
        self.score = 0
        # Starting Point
        self.player_x = 42
        self.player_y = 100
        self.player_xy = 0
        self.player_vy = 0
        self.gravity = 0.1
        # make items
        self.fruit = [(randint(0, 104), i * 60, True) for i in range(5)]
        self.star = [(i * 60, randint(0, 104), True) for i in range(1)]
        self.bomb = [(i * 60, randint(0, 104), True) for i in range(1)]
        self.enemy = [(i * 60, 0, True) for i in range(1)]
        self.shots = []
        # flgs
        self.speed = 0
        self.counter = 0
        self.GAME_OVER = False
        self.START_FLG = False

        pyxel.playm(0, loop=True)
        pyxel.run(self.update, self.draw)
Esempio n. 11
0
    def game_start(self):           #ゲーム開始
        self.direction = RIGHT
        # スコア
        if self.stagenumber==1:
            self.score = 0
        if self.stagenumber > 1:
            self.score = self.score
        #倒したモンスター数
        self.countmonster=0
        #ハート
        self.countheart=5
        # 始めの位置
        self.player_x = 20
        self.player_y = 60
        self.player_vy = 0
        self.monster = [(200,randint(30,100), True)for i in range(1)]
        self.fire=[]
        self.flag=0
        for i in range(len(self.monster)):
            self.fire.append((self.monster[i][0]-16,self.monster[i][1],self.monster[i][2],self.flag))

        if self.stagenumber==1:
            self.stardrop=10
        if self.stagenumber ==2:
            self.stardrop=15
        if self.stagenumber == 3:
            self.stardrop=20
        self.star=[(randint(0,255),randint(0,150), True)for i in range(self.stardrop)]

        pyxel.playm(0, loop=True)
        pyxel.run(self.update_game, self.draw_game)
Esempio n. 12
0
    def __init__(self):
        # 画面サイズの設定 captionはwindow枠にtext出せる
        pyxel.init(160, 120, caption="Hello Pysel")
        # editorデータ読み込み(コードと同じフォルダにある)
        pyxel.load("my_resource.pyxres")
        #画面遷移の初期化
        self.scene = SCENE_TITLE
        #得点初期化
        self.score = 0
        self.highscore = 0
        # 初期配置
        self.player_x = 80
        self.player_y = 60
        # 初期追加速度
        self.addspeed = 0
        # 速度制御用flag
        self.isSpeedUp = False
        # アイテム取得数
        self.getitem = 0
        # fruit初期配置 x座標 y座標 表示flag on 種類(0と1)を4個用意
        self.fruit = [(i * 60, randint(0, 104), True, randint(0, 1)) for i in range(4)]

        #BGM再生(MUSIC 0番をloop再生)
        pyxel.playm(1, loop = True)
        # 実行開始 更新関数 描画関数
        pyxel.run(self.update, self.draw)
Esempio n. 13
0
 def toggle_music(self):
     if self.play_music:
         self.play_music = False
         pyxel.stop()  # Stop all sound and music on all channels
     else:
         self.play_music = True
         pyxel.playm(0, loop=True)  # Play music track 0
    def __init__(self):
        pyxel.init(160, 120, caption="Pyxel Jump")

        pyxel.load("assets/jump_game.pyxel")

        # プレイヤー関連
        self.score = 0
        self.game_over_frame = 0
        self.player_x = 36
        self.player_y = -16
        self.player_vy = 0
        self.player_is_alive = True

        # ジャンプ関連
        self.jump_gauge = 20
        self.jump_start_time = 0

        # オブジェクト関連
        self.upper_star = [(-10, 75), (40, 65), (90, 60)]
        self.downer_star = [(10, 25), (70, 35), (120, 15)]
        self.obstacle = [(i * 60, randint(8, 104), True) for i in range(4)]
        self.water = [(i * 60, randint(0, 104), randint(0, 2), True)
                      for i in range(4)]

        pyxel.playm(0, loop=True)

        pyxel.run(self.update, self.draw)
Esempio n. 15
0
    def __init__(self):
        # init screen
        pyxel.init(160, 120, caption="Pyxel Jump")

        # load Pyxel resource file(.pyxres)
        # we can create or edit images and sounds with attached Pyxel Editor
        # pyxeleditor assets/jump_game.pyxres
        pyxel.load('assets/jump_game.pyxres')

        # game status
        self.score = 0
        self.player_x = 72  # x coordinate of player
        self.player_y = -16  # y coordinate of player
        self.player_vy = 0
        self.player_is_alive = True

        self.far_cloud = [(-10, 75), (40, 65), (90, 60)]
        self.near_cloud = [(10, 25), (70, 35), (120, 15)]
        # coordinate of floor to jump
        # ex: [(0, 34, True), (60, 92, True), (120, 59, True), (180, 84, True)]
        self.floor = [(i * 60, randint(8, 104), True) for i in range(4)]
        self.fruit = [(i * 60, randint(0, 104), randint(0, 2), True)
                      for i in range(4)]  # coordinate of fruit

        # Play music(0-7)
        pyxel.playm(0, loop=True)

        # Runs Pyxel app
        pyxel.run(self.update, self.draw)
Esempio n. 16
0
 def update_gameover_scene(self):
     #ENTERでタイトル画面に遷移
     if pyxel.btnp(pyxel.KEY_ENTER):
         #BGM再生(MUSIC 0番をloop再生)
         pyxel.playm(1, loop = True)
         self.score = 0 #得点初期化
         self.scene = SCENE_TITLE
Esempio n. 17
0
    def __init__(self):
        pyxel.init(SCREEN_WIDTH,
                   SCREEN_HEIGHT,
                   caption="1024",
                   palette=PALETTE)
        pyxel.load("2048.pyxres")
        self.field = TABLE.copy()
        self.design = 1
        self.wins = 0
        self.options = 1
        self.death = False
        self.win = False
        # звук когда игрок долго жмет на одну кнопку)))
        pyxel.sound(19).set(note="c3e3g3c4c4",
                            tone="s",
                            volume="7",
                            effect=("n" * 4 + "f"),
                            speed=7)
        # звук смерти
        pyxel.sound(29).set(
            note="f3 b2 f2 b1  f1 f1 f1 f1",
            tone="p",
            volume=("4" * 4 + "4321"),
            effect=("n" * 7 + "f"),
            speed=9,
        )
        add_random(self.field)
        pyxel.playm(MUSIC, loop=True)

        pyxel.run(self.update, self.draw)
Esempio n. 18
0
    def update(self):
        #BGM_Ctr
        if self.music_flug == False:
            pyxel.playm(0, loop=True)
            self.music_flug = True

        if pyxel.btnp(pyxel.KEY_Q):
            pyxel.quit()

        #Attack_action
        if self.atk_flug == 0:
            #Hado
            if pyxel.btnp(pyxel.KEY_SPACE):
                if (self.move_r == 0) and (self.move_l == 0):
                    if len(self.Hadou) < 1:
                        self.atk_flug = 1
                        self.atk_count = 1
                        pyxel.play(1, 10, loop=False)
                        new_Hadou = Hadou(self.Player.player_x + 8,
                                          self.Player.player_y + 3)
                        self.Hadou.append(new_Hadou)
            #Syoryu
            if pyxel.btnp(pyxel.KEY_V):
                if (self.move_r == 0) and (self.move_l == 0):
                    self.atk_flug = 1
                    self.atk_count = 1
                    self.up_flug = 1
                    pyxel.play(1, 11, loop=False)
            #Move_right
            if pyxel.btn(pyxel.KEY_RIGHT):
                if self.Player.player_x < 51:
                    self.move_r = 1
                    self.Player.update(self.Player.player_x + 0.5,
                                       self.Player.player_y)
            else:
                self.move_r = 0
            #Move_left
            if pyxel.btn(pyxel.KEY_LEFT):
                if self.Player.player_x > 0:
                    self.move_l = 1
                    self.Player.update(self.Player.player_x - 0.5,
                                       self.Player.player_y)
            else:
                self.move_l = 0
        else:
            self.atk_count = self.atk_count + 1
            if self.atk_count > 18:
                self.atk_flug = 0
                self.atk_count = 0
                self.up_flug = 0

        #Hadou_move
        if len(self.Hadou) >= 1:
            if self.Hadou[0].hadou_x < 70:
                x = self.Hadou[0].hadou_x + 1.5
                y = self.Hadou[0].hadou_y
                self.Hadou[0].update(x, y)
            else:
                del self.Hadou[0]
Esempio n. 19
0
 def update_title(self):
     if self.mode == TITLE:
         if pyxel.btnp(pyxel.KEY_ENTER) and self.fc == -1:
             self.fc = pyxel.frame_count + SPEED
             self.title_fc = pyxel.frame_count + SPEED * 2
         if self.title_fc == pyxel.frame_count:
             self.mode = SELECTING
             pyxel.playm(1, loop=True)
Esempio n. 20
0
 def draw(self):
     if self.dead:
         self.draw_death()
     elif self.intro:
         self.draw_intro()
     else:
         if not self.played_game_music:
             pyxel.playm(0, loop=True)
             self.played_game_music = True
         self.draw_game()
Esempio n. 21
0
    def __init__(self):
        pyxel.init(160, 120, caption="JoJo's Bizarre Program")

        pyxel.load("assets/combined.pyxres")

        self.player_x = 0
        self.player_y = 0

        pyxel.playm(0, loop=True)
        pyxel.run(self.update, self.draw)
Esempio n. 22
0
def play_music(msc, looping=False):
    if globals.g_music_on == False:
        return

    if msc not in MUSIC:
        return

    pyxel.stop()

    pyxel.playm(msc, loop=looping)
Esempio n. 23
0
    def display(self):
        global MUSIC, IS_MODE_TERMINATE
        if MUSIC != 2:
            pyxel.stop()
            MUSIC = 2
            pyxel.playm(MUSIC, loop=True)

        pyxel.cls(5)
        if pyxel.btn(pyxel.KEY_SPACE):
                IS_MODE_TERMINATE =1
Esempio n. 24
0
 def __init__(self):
     """Initial game setup."""
     LOGGER.info("Making the app.")
     self.start = time.clock()
     bounds = (0, 0, 55, 55)
     pyxel.init(*bounds[2:], caption="Beetle Charm")
     pyxel.load("assets/beetle-box.pyxel")
     self.player = Player(bounds)
     self.visible_map = VisibleMap(bounds)
     self.things = [self.visible_map, self.player]
     pyxel.playm(0, loop=True)
Esempio n. 25
0
    def reset(self):
        """Initiate key variables (direction, snake, apple, score, etc.)"""

        self.direction = RIGHT
        self.snake = deque()
        self.snake.append(START)
        self.death = False
        self.score = 0
        self.generate_apple()

        pyxel.playm(0, loop=True)
Esempio n. 26
0
    def __init__(self):
        pyxel.init(128, 128, title="Pyxel Platformer")
        pyxel.load("assets/platformer.pyxres")

        # Change enemy spawn tiles invisible
        pyxel.image(0).rect(0, 8, 24, 8, TRANSPARENT_COLOR)

        global player
        player = Player(0, 0)
        spawn_enemy(0, 127)
        pyxel.playm(0, loop=True)
        pyxel.run(self.update, self.draw)
Esempio n. 27
0
 def __init__(self, x=12, y=2):
     self.x, self.y, self.direction = x, y, 3  # 主人公の位置、主人公の向き
     self.sx, self.sy = 0, 0  # マスの途中のアニメに使う
     self.update = self._update().__next__
     self.idle_start = pyxel.frame_count
     self.textbox = None
     self.fdraw_poison = False
     self.original_state = None  # fieldより下はないはずなので切っておく
     pyxel.playm(self.Music, loop=True)
     self.traps = ((12, 2, lambda: Blackout(lambda: Castle(22, 15))),  # 街、階段とか # lambdaで「あとで実行」をここで書ける # Battleを書く場合があるかもしれないのでクラス変数にしない
                   (13, 27, lambda: Blackout(lambda: Villege(None, None, self.direction))),
                   (4, 29, lambda: Blackout(lambda: Dungeon(11, 26))), )
Esempio n. 28
0
    def hurt(self, damage, dtype=DType.MELEE):
        super().hurt(damage, dtype)
        if dtype == DType.MELEE:
            self.should_tp = True

        if self.pv < 1:
            pyxel.stop()
            pyxel.playm(2, loop=True)
            for e in self.state_ref.enemies:
                if e.parent == self:
                    e.hurt(10)
            self.state_ref.level.items.append(Book(square=self.square))
Esempio n. 29
0
    def _play(self):
        self._is_playing = True

        for i in range(pyxel.MUSIC_CHANNEL_COUNT):
            self._play_pos[i] = 0

        self._music_picker.is_enabled = False
        self._play_button.is_enabled = False
        self._stop_button.is_enabled = True
        self._loop_button.is_enabled = False

        pyxel.playm(self._music_picker.value, loop=self._loop_button.value)
    def initialize(self):
        for i in range(0, int(256/self.stal_width)+1):
            self.stals.append({
                'x': 255 + (i*self.stal_width),
                'height': np.random.randint(1, self.max_stal_height),
                'color': self.random_color()
            })
        self.hero_height = self.hero_starting_height
        self.score = 0
        self.distance = 0
        self.ppd = 0

        pyxel.playm(0, loop=True)