Beispiel #1
0
    def draw(self):
        pyxel.cls(1)

        pyxel.text(6, 6, "sound(snd).set(note,tone,volume,effect,speed)", 7)
        pyxel.rect(12, 14, 177, 35, 2)
        pyxel.text(16, 17, "note  :[CDEFGAB] + [ #-] + [0-4] or [R]", 9)
        pyxel.text(16, 25, "tone  :[T]riangle [S]quare [P]ulse [N]oise", 9)
        pyxel.text(16, 33, "volume:[0-7]", 9)
        pyxel.text(16, 41, "effect:[N]one [S]lide [V]ibrato [F]adeOut", 9)
        pyxel.text(6, 53, "music(msc).set(ch0,ch1,ch2,ch3)", 7)

        pyxel.text(6, 62, "play(ch,snd,loop=False)", 7)
        pyxel.text(6, 71, "playm(msc,loop=False)", 7)
        pyxel.text(6, 80, "stop([ch])", 7)

        pyxel.rectb(6, 97, 188, 47, 14)
        pyxel.rect(6, 91, 29, 7, 14)
        pyxel.text(7, 92, "CONTROL", 1)

        pyxel.text(12, 102, "1: Play all channels", 14)
        pyxel.text(12, 110, "2: Play channel #0 (Melody)", 14)
        pyxel.text(12, 118, "3: Play channel #1 (Bass)", 14)
        pyxel.text(12, 126, "4: Play channel #2 (Drums)", 14)
        pyxel.text(12, 134, "5: Stop playing", 14)

        pyxel.text(137, 107, "play_pos(ch)", 15)

        for i in range(3):
            x = 140 + i * 16
            y = 123 + math.sin(pyxel.frame_count * 0.1 + i * 2.1) * 5
            col = 15 if pyxel.play_pos(i) else 13
            pyxel.pal(1, col)
            pyxel.blt(x, y, 0, 0, 0, 8, 8, 0)
        pyxel.pal()
Beispiel #2
0
    def update(self):
        if pyxel.btn(pyxel.KEY_A):
            self.player.run(-1)
        if pyxel.btn(pyxel.KEY_D):
            self.player.run(1)
        if pyxel.btn(pyxel.KEY_I):
            self.test_val += 1
        if pyxel.btn(pyxel.KEY_O):
            self.test_val -= 1
        if pyxel.btnp(pyxel.KEY_S):
            if self.player.grounded:
                self.sound.sfx_buildup()
        if not pyxel.btn(pyxel.KEY_S):
            self.sound.sfx_stop()
        if pyxel.btnp(pyxel.KEY_S, 60, 30):
            print(pyxel.frame_count)
            if self.player.grounded:
                self.player.charge()
        if pyxel.btn(pyxel.KEY_SPACE):
            if self.player.grounded:
                self.player.jump()
                self.sound.sfx_jump()
        if pyxel.btn(pyxel.KEY_ESCAPE):
            pyxel.quit()
        if pyxel.btn(pyxel.KEY_T):
            pyxel.pal(1, 7)
        else:
            pyxel.pal()
        if pyxel.btn(pyxel.KEY_P):
            import pdb
            pdb.set_trace()

        self.camera.last_offset_x, self.camera.last_offset_y = self.camera.offset_x, self.camera.offset_y
        self.update_player()
Beispiel #3
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)
Beispiel #4
0
    def draw(self):
        # 上
        pyxel.blt(self.x, self.y, 2, 96, 0,  160, -64, 3)
        # 中

        # コア部分
        if self.brokenState in (1, 2):
            Drawing.setBrightnessWithoutBlack(self.coreBrightness)
            BossLast1Core.drawCore(self.coreX, self.coreY, self.rad)
            pyxel.pal()
            if self.cnt & 3 == 0:
                if self.coreBrightState == 0:
                    self.coreBrightness += 1
                    if self.coreBrightness >= 4:
                        self.coreBrightState = 1
                else:
                    self.coreBrightness -= 1
                    if self.coreBrightness <= -3:
                        self.coreBrightState = 0
        pyxel.blt(self.x +32, self.y +64, 2, 0, 128, 96, 64, 3)
        if self.brokenState in (0,1):
            if self.hit:
                Drawing.setBrightnessWithoutBlack(1)
            pyxel.blt(self.x +32, self.y +64, 2, 0, self.brokenState* 64, 96, 64, 3)
            pyxel.pal()
        # 下
        pyxel.blt(self.x, self.y +128, 2, 96, 0, 160, 64, 3)
Beispiel #5
0
 def draw(self):
     pyxel.cls(7)
     pyxel.pal(1, 0)
     pyxel.text(200, 230, 'x: {}\ny: {}'.format(self.hero.x, self.hero.y),
                1)
     self.one_bit.draw()
     self.hero.draw()
Beispiel #6
0
def draw_tile(x, y, image_num, color):
    i = image_num // 10
    j = image_num % 10
    pyxel.pal(7, color)
    pyxel.blt(x * TILE_SIZE, y * TILE_SIZE, 0, j * TILE_SIZE, i * TILE_SIZE,
              TILE_SIZE, TILE_SIZE)
    pyxel.pal()
Beispiel #7
0
    def draw(self):
        pyxel.cls(1)

        pyxel.text(6, 6, 'sound(snd).set(note,tone,volume,effect,speed)', 7)
        pyxel.rect(12, 16, 188, 52, 2)
        pyxel.text(16, 20, 'note  :[CDEFGAB] + [ #-] + [0-4] or [R]', 9)
        pyxel.text(16, 28, 'tone  :[T]riangle [S]quare [P]ulse [N]oise', 9)
        pyxel.text(16, 36, 'volume:[0-7]', 9)
        pyxel.text(16, 44, 'effect:[N]one [S]lide [V]ibrato [F]adeOut', 9)

        pyxel.text(6, 62, 'play(ch,snd,loop=False)', 7)
        pyxel.text(6, 76, 'stop(ch)', 7)

        pyxel.rectb(6, 97, 193, 143, 14)
        pyxel.rect(6, 91, 34, 97, 14)
        pyxel.text(7, 92, 'CONTROL', 1)

        pyxel.text(12, 102, '1: Play all channels', 14)
        pyxel.text(12, 110, '2: Play channel #0 (Melody)', 14)
        pyxel.text(12, 118, '3: Play channel #1 (Bass)', 14)
        pyxel.text(12, 126, '4: Play channel #2 (Drums)', 14)
        pyxel.text(12, 134, '5: Stop playing', 14)

        for i, v in enumerate(self.is_playing):
            pyxel.pal(1, v and 15 or 13)
            pyxel.blt(140 + i * 16,
                      116 + math.sin(pyxel.frame_count * 0.1 + i * 2.1) * 5, 0,
                      0, 0, 8, 8, 0)
        pyxel.pal()
Beispiel #8
0
    def on_draw(self):
        slider_pos = int(BUTTON_SIZE +
                         self._bar_size * self.value / self._denominator + 0.5)

        if self._is_horizontal:
            x = self.x + slider_pos
            y = self.y + 2
            pyxel.rect(x, y, x + self._slider_size - 1, y + 2, 1)
        else:
            x = self.x + 2
            y = self.y + slider_pos
            pyxel.rect(x, y, x + 2, y + self._slider_size - 1, 1)

        if self._inc_blink_time > 0 or self._dec_blink_time > 0:
            if self._dec_blink_time > 0:
                x = self.x + 1
                y = self.y + 1
            elif self._is_horizontal:
                x = self.x + self.width - 5
                y = self.y + 1
            else:
                x = self.x + 1
                y = self.y + self.height - 5

            w, h = (4, 5) if self._is_horizontal else (5, 4)

            pyxel.pal(6, 7)
            pyxel.blt(x, y, 3, x, y + 16, w, h)
            pyxel.pal()
Beispiel #9
0
    def on_draw(self):
        x = self.x + self._interval * (self.value % self._col)
        y = self.y + self._interval * (self.value // self._col)

        pyxel.pal(13, 7)
        pyxel.blt(x, y, 3, x, y + 16, BUTTON_SIZE, BUTTON_SIZE)
        pyxel.pal()
Beispiel #10
0
    def on_draw(self):
        pyxel.pal(13, 7)

        x = self.x + self._interval * (self.index % self._col)
        y = self.y + self._interval * (self.index // self._col)
        pyxel.blt(x, y, 3, x, y + 16, BUTTON_SIZE, BUTTON_SIZE)

        pyxel.pal()
Beispiel #11
0
    def on_draw(self):
        pyxel.pal(13, 7)

        x = self.x + self._interval * (self.value % self._col)
        y = self.y + self._interval * (self.value // self._col)
        pyxel.blt(x, y, 3, x, y + 16, self.width, self.height)

        pyxel.pal()
Beispiel #12
0
	def draw(self):
		n = int(self.dr)		#int(self.dr)+6 & 7
		spmap = enemy1_spmap[n]
		spno = spmap[0] + int(gcommon.game_timer%8/4)*3*16
		if gcommon.set_color_shadow():
			pyxel.blt(self.x+16, self.y+16, 1, spno, 0, 16 * spmap[1], 16* spmap[2], gcommon.TP_COLOR)
			pyxel.pal()
		pyxel.blt(self.x, self.y, 1, spno, 0, 16 * spmap[1], 16* spmap[2], gcommon.TP_COLOR)
Beispiel #13
0
	def draw(self):
		n = (self.cnt>>2) % len(__class__.lightTable)
		pyxel.pal(8, __class__.lightTable[n])
		sp = __class__.spTable[self.shotState]
		pyxel.blt(gcommon.sint(self.x -11.5), gcommon.sint(self.y -11.5), 2, 0, 0, 24, 24, 3)
		if sp >= 0:
			pyxel.blt(gcommon.sint(self.x -11.5)+4, gcommon.sint(self.y -11.5)+4, 2, sp*16, 24, 16, 16)
		pyxel.pal()
Beispiel #14
0
    def __on_draw(self):
        col = (BUTTON_PRESSED_COLOR if self.is_pressed else
               (BUTTON_ENABLED_COLOR
                if self.is_enabled else BUTTON_DISABLED_COLOR))

        pyxel.pal(BUTTON_ENABLED_COLOR, col)
        pyxel.blt(self.x, self.y, self._img, self._sx, self._sy, self.width,
                  self.height, 0)
        pyxel.pal()
Beispiel #15
0
    def on_draw(self):
        if not self.is_enabled or self._blink_time > 0:
            pyxel.pal(13, 7 if self.is_enabled else 5)

            x = self.x
            y = self.y
            pyxel.blt(x, y, 3, x, y + 16, self.width, self.height)

            pyxel.pal()
Beispiel #16
0
 def __on_draw(self):
     pyxel.pal(BUTTON_ENABLED_COLOR, BUTTON_PRESSED_COLOR)
     pyxel.blt(
         self.x + self.value * 9,
         self.y,
         self._img,
         self._sx + self.value * 9,
         self._sy,
         7,
         7,
     )
     pyxel.pal()
Beispiel #17
0
 def __on_draw(self):
     pyxel.pal(BUTTON_ENABLED_COLOR, self.button_color)
     pyxel.blt(
         self.x,
         self.y,
         self._img,
         self._u,
         self._v,
         self.width,
         self.height,
         0,
     )
     pyxel.pal()
Beispiel #18
0
    def update(self):
        if self.palette_cycle_timer < 5:
            self.palette_cycle_timer += 1
        else:
            self.palette_cycle_timer = 0
            self.palette_cycle = (self.palette_cycle + 1) % COLOUR_CYCLE_LEN
            for i, colour in enumerate(COLOUR_CYCLE_BASE):
                pyxel.pal(
                    colour,
                    COLOUR_CYCLE[(self.palette_cycle + i) % COLOUR_CYCLE_LEN])

        if pyxel.btnp(pyxel.KEY_SPACE) or pyxel.btnp(pyxel.GAMEPAD_1_A):
            state.game.set_state(STATE_GAME)
Beispiel #19
0
 def draw(self):
     for c in range(palette.NUM_COLOURS):
         pyxel.pal(palette.DEFAULT[c], self.pal_control.get_col(c))
 
     pyxel.cls(self.pal_control.get_col(0))
     
     self.stage.draw(self.screen_shake.x, self.screen_shake.y)
     self.hud.draw(self.screen_shake.x, self.screen_shake.y)
     
     self.main_menu.draw(self.screen_shake.x, self.screen_shake.y)
     
     pyxel.pal()
     
Beispiel #20
0
	def draw(self):
		pyxel.cls(0)
		self.drawStar()

		pyxel.pal()
		x1 = 72
		x2 = MENU_VALUE_X
		Drawing.showTextHCenter(8, "OPTION")
		y = 50
		gcommon.setMenuColor(OPTIONMENU_BGM_VOL, self.menuPos)
		Drawing.showText(x1, y, "BGM VOLUME")
		Drawing.showText(x2, y, str(Settings.bgmVolume).rjust(2))
		if OPTIONMENU_BGM_VOL == self.menuPos:
			#gcommon.drawUpDownMarker(x2 -10, y)
			Drawing.drawUpDownMarker2(x2 -10, y, 0, 10, Settings.bgmVolume)
		y += 20

		gcommon.setMenuColor(OPTIONMENU_SOUND_VOL, self.menuPos)
		Drawing.showText(x1, y, "SE VOLUME")
		se = "ON " if Settings.soundVolume > 0 else "OFF"
		Drawing.showText(x2, y, se)
		if OPTIONMENU_SOUND_VOL == self.menuPos:
			leftMarker = (Settings.soundVolume > 0)
			Drawing.drawLeftMarker(x2 -10, y, leftMarker)
			Drawing.drawRightMarker(x2 +len(se)*8 + 2, y, not leftMarker)
		y += 20

		gcommon.setMenuColor(OPTIONMENU_MOUSE_ENABLED, self.menuPos)
		Drawing.showText(x1, y, "MOUSE")
		mouseOnOff = "ON " if Settings.mouseEnabled else "OFF"
		Drawing.showText(x2, y, mouseOnOff)
		if OPTIONMENU_MOUSE_ENABLED == self.menuPos:
			leftMarker = (Settings.mouseEnabled == True)
			Drawing.drawLeftMarker(x2 -10, y, leftMarker)
			Drawing.drawRightMarker(x2 +len(se)*8 + 2, y, not leftMarker)
		y += 20

		gcommon.setMenuColor(OPTIONMENU_SCORE_RANKIG, self.menuPos)
		Drawing.showTextHCenter(y, "SCORE RANKING")
		y += 20

		gcommon.setMenuColor(OPTIONMENU_EXIT, self.menuPos)
		Drawing.showTextHCenter(y, "EXIT")
		
		Drawing.setBrightness1()
		pyxel.blt(32, 48 + self.menuPos * 20, 4, 32, 48 + self.menuPos * 20, 192, 12)
		pyxel.pal()

		if self.mouseManager.visible:
			self.mouseManager.drawMenuCursor()
Beispiel #21
0
    def draw100(self):
        self.drawStar()

        if self.state in (100, 200):
            self.drawTitleNormal()
        elif self.state == 102 or self.state == 103:
            pyxel.pal()
            # 文字枠
            for c in TitleScene.colorTable1:
                pyxel.pal(c, 7)
            table = TitleScene.colorTable3[self.subState]
            for t in table:
                pyxel.pal(t[0], t[1])
            pyxel.blt(0, __class__.title_y, 1, 0, 40, 256, 80,
                      0)  # pyxel.pal()
        elif self.state == 104:
            self.drawTitleNormal()
            self.drawFlash(self.subCnt * 8, 32)

        self.drawMenu(self.state == 200, 1.0)

        pyxel.text(200, 188, "CREDIT(S) " + str(self.credits), 7)
        pyxel.blt(10, 186, 0, 88, 120, 8, 8, 0)
        pyxel.text(20, 188, "2021 ONTAKE44", 7)

        Drawing.showTextHCentor2(188, "VER " + gcommon.VERSION, 7)

        pyxel.pal()
        if self.mouseManager.visible:
            self.mouseManager.drawMenuCursor()
Beispiel #22
0
 def _draw_sound_button(self, snd, col):
     pyxel.pal(13, col)
     x = (snd % 16) * 13
     y = (snd // 16) * 9
     pyxel.blt(
         self.x + x + 6,
         self.y + y + 5,
         EDITOR_IMAGE,
         x,
         y + 121,
         11,
         7,
     )
     pyxel.pal()
Beispiel #23
0
 def _draw_sound_button(self, snd, col):
     pyxel.pal(13, col)
     x = (snd % 16) * 13
     y = (snd // 16) * 9
     pyxel.blt(
         self.x + x + 6,
         self.y + y + 5,
         pyxel.IMAGE_BANK_FOR_SYSTEM,
         EDITOR_IMAGE_X + x,
         EDITOR_IMAGE_Y + y + 121,
         11,
         7,
     )
     pyxel.pal()
Beispiel #24
0
 def draw(self):
     if self.cnt & 4 == 0:
         if self.direction == 0:
             # 上
             pyxel.blt(self.x - 7, self.y, 0, 0, 240, 15, 13, 0)
         else:
             # 下
             pyxel.blt(self.x - 7, self.y - 13, 0, 0, 240, 15, -13, 0)
     if self.text != None and self.text != "":
         pyxel.pal(7, 8)
         if self.direction == 0:
             Drawing.showText(self.x + 10, self.y + 4, self.text)
         else:
             Drawing.showText(self.x + 10, self.y - 9, self.text)
         pyxel.pal()
Beispiel #25
0
	def draw(self):
		if gcommon.set_color_shadow():
			pyxel.blt(self.x+16, self.y+16, self.imageIndex, self.imageX, self.imageY, 48, 32, gcommon.TP_COLOR)
			pyxel.pal()
		pyxel.blt(self.x, self.y, self.imageIndex, self.imageX, self.imageY, 48, 32, gcommon.TP_COLOR)
		if self.cnt & 1 == 0:
			if self.cnt >= self.speedup:
				#spr(14,o.x+2,o.y-6)
				#spr(14,o.x+17,o.y-6)
				pyxel.blt(self.x+4, self.y-12, self.imageIndex, self.imageX+48, self.imageY, 10, 16, gcommon.TP_COLOR)
				pyxel.blt(self.x+34, self.y-12, self.imageIndex, self.imageX+48, self.imageY, 10, 16, gcommon.TP_COLOR)
			else:
				#spr(15,o.x+2,o.y-6)
				#spr(15,o.x+17,o.y-6)
				pyxel.blt(self.x+4, self.y-12, self.imageIndex, self.imageX+48, self.imageY+16, 10, 16, gcommon.TP_COLOR)
				pyxel.blt(self.x+34, self.y-12, self.imageIndex, self.imageX+48, self.imageY+16, 10, 16, gcommon.TP_COLOR)
Beispiel #26
0
 def draw(self):
     Drawing.setBrightnessWithoutBlack(self.coreBrightness)
     if self.cycleCount & 1 == 0:
         BossLast1Core.drawCoreAngle(self.x, self.y, self.rad, self.angle)
     else:
         BossLast1Core.drawCoreAngle(self.x, self.y, self.rad, -self.angle)
     pyxel.pal()
     if self.cnt & 3 == 0:
         if self.coreBrightState == 0:
             self.coreBrightness += 1
             if self.coreBrightness >= 4:
                 self.coreBrightState = 1
         else:
             self.coreBrightness -= 1
             if self.coreBrightness <= -3:
                 self.coreBrightState = 0		
Beispiel #27
0
def set_color_shadow():
    if game_timer & 1 == 1:
        for c in range(0, 13):
            pyxel.pal(c, 0)
        pyxel.pal(13, 0)
        pyxel.pal(14, 0)
        pyxel.pal(15, 0)
        return True
    else:
        return False
Beispiel #28
0
    def draw(self):
        # 画面のクリア
        pyxel.cls(1)

        # 描画テスト
        for i in range(10):
            # 矩形
            pyxel.rectb(
                random.randrange(0, pyxel.width),
                random.randrange(0, pyxel.height),
                random.randrange(0, pyxel.width),
                random.randrange(0, pyxel.height),
                random.randrange(0, 16))

            # 線
            pyxel.line(
                random.randrange(0, pyxel.width),
                random.randrange(0, pyxel.height),
                random.randrange(0, pyxel.width),
                random.randrange(0, pyxel.height),
                random.randrange(0, 16))

            # 点
            pyxel.pix(
                random.randrange(0, pyxel.width),
                random.randrange(0, pyxel.height),
                random.randrange(0, 16))

            # 円
            pyxel.circb(
                random.randrange(0, pyxel.width),
                random.randrange(0, pyxel.height),
                random.randrange(0, 16),
                random.randrange(0, 16))

            # パレットの入れ替え
            pyxel.pal(random.randrange(0, 16), random.randrange(0, 16))

        # 画像の描画
        pyxel.blt((pyxel.width - self.cat['width']) / 2, (pyxel.height - self.cat['height']) / 2, 0, 0, 0, self.cat['width'], self.cat['height'])

        # パレットを戻す
        pyxel.pal()
Beispiel #29
0
 def __init__(self):
     global alive_cells
     # create a glider on start
     alive_cells = [
         simCell(25, 25),
         simCell(26, 26),
         simCell(24, 27),
         simCell(25, 27),
         simCell(26, 27)
     ]  # x, y, alive
     # Initialize a window. Max size is 256x256 pixels.
     pyxel.init(50, 50)
     self.x = 50
     self.y = 50
     pyxel.mouse(False)
     pyxel.pal(12, pyxel.COLOR_RED)  # set 12 to "red"
     pyxel.pal(5, pyxel.COLOR_WHITE)  # is the set color of the living cells
     pyxel.cls(0)
     pyxel.run(self.update, self.draw)
Beispiel #30
0
    def drawMenu(self, startFlag, rate):
        pyxel.pal()
        y = __class__.menu_top_y
        if rate < 1.0:
            gcommon.setMenuColor(0, -1)
        else:
            if (startFlag and self.cnt & 2 == 0) or (startFlag == False
                                                     and self.menuPos == 0
                                                     and self.cnt & 16 == 0):
                pyxel.pal(7, 8)
                pyxel.pal(5, 4)
            else:
                gcommon.setMenuColor(0, self.menuPos)
        text = gcommon.difficultyText[self.difficulty] + " START"
        Drawing.showTextRateHCenter(y, text, rate)
        if rate == 1.0 and self.menuPos == 0:
            Drawing.drawLeftMarker(128 - 8 - 48 - 4, y, self.difficulty > 0)
            Drawing.drawRightMarker(128 + 48 + 4, y, self.difficulty < 2)
        pyxel.pal()

        y += 15
        gcommon.setMenuColor(1, self.menuPos)
        Drawing.showTextRateHCenter(y, "CUSTOM START", rate)

        y += 15
        gcommon.setMenuColor(2, self.menuPos)
        Drawing.showTextRateHCenter(y, "BOSS RUSH START", rate)

        y += 15
        gcommon.setMenuColor(3, self.menuPos)
        Drawing.showTextRateHCenter(y, "OPTION", rate)

        y += 15
        gcommon.setMenuColor(4, self.menuPos)
        Drawing.showTextRateHCenter(y, "EXIT", rate)

        if rate == 1.0:
            Drawing.setBrightness1()
            pyxel.blt(48, __class__.menu_top_y - 2 + self.menuPos * 15, 4, 48,
                      __class__.menu_top_y - 2 + self.menuPos * 15, 160, 12)
            pyxel.pal()