Esempio n. 1
0
    def __init__(self, track, client):
        self.track = track
        self.client = client
        self.stored_trail = []
        self.local_car = None
        self.render_state = RenderState.MENU
        self.winner = None

        # Time-specific variables
        self.start_time = None
        self.prev_time = None
        self.dt = 0.0
        self.gametime = 0.0

        # Setup buttons
        self.play_button = Button('Play', 60, 100, 30, 15, 4, 9)
        self.quit_button = Button('Quit', 170, 100, 30, 15, 4, 9)
        self.play_button.set_on_press(lambda: self.client.send('start_game'))
        self.quit_button.set_on_press(lambda: pyxel.quit())

        # Initialize pyxel
        # The width is actually 255 because max pyxel width  is 255,
        # but we will assume it is 256
        pyxel.init(WIDTH - 1, HEIGHT, fps=30)
        pyxel.mouse(True)  # Use the mouse
Esempio n. 2
0
    def __init__(self):
        self.IMG_ID0 = 0
        self.IMG_ID1 = 1
        self.IMG_ID2 = 2
        self.IMG_ID0_X = 60
        self.IMG_ID0_Y = 65
        self.game_over = False
        self.game_end = False
        self.boss_flug = False
        self.boss_count = 1
        self.score = 0
        self.shots = []
        self.enemys = []
        self.boss_hp = 500
        self.bombs = []
        self.p_ship = Ship()
        self.state = 0
    

        #メインウィンドウの作成
        pyxel.init(WINDOW_W, WINDOW_H, caption="Cat Shotting Game!")
        # ドット絵を読み込む
        pyxel.image(self.IMG_ID0).load(0, 0, "assets/cat_16x16.png")
        pyxel.image(self.IMG_ID1).load(0, 0, "assets/pyxel_logo_38x16.png")
        pyxel.image(self.IMG_ID2).load(0, 0, "assets/pyxel_logo_152x64.png")

        pyxel.mouse(False)
      
        pyxel.run(self.update, self.draw)#位置情報の更新と描画
Esempio n. 3
0
 def __init__(self):
     self.ConexionMensajeMostar = 0
     self.nombre_equipo = ""
     self.MensajeInformacionHost = ""
     self.MensajeInformacionClient = ""
     self.direccion_equipo = ""
     self.PuntosPlayerOne = 0
     self.PuntosPlayerTwo = 0
     self.OnePlayerY = 63
     self.TwoPlayerY = 63
     self.BallX = 120
     self.BallY = 75
     self.Velocity = 3
     self.Score = 0
     self.MensajeGanador = ""
     self.Horizontal = True
     self.Vertical = False
     self.PASOS = 4
     self.PlayerOne = Players(15,self.OnePlayerY,4,25)
     self.PlayerTwo = Players(220,self.TwoPlayerY,4,25)
     self.BallDetails = Ball(self.BallX,self.BallY,2,2)
     self.ColorObjectsBG = 7
     self.ColorBG = 0
     self.ColorObjects =7
     self.nombre_equipo = socket.gethostname()
     self.direccion_equipo = socket.gethostbyname(self.nombre_equipo)
     self.MensajeInformacionHost = str(self.nombre_equipo)+"\nIP: "+str(self.direccion_equipo)
     self.ConexionMensaje = "Esperando conexion...\n{}".format(self.direccion_equipo)
     self.ConfigurarLAN()
     pyxel.init(240,150,caption="PongGame LAN Server",fullscreen=False)
     pyxel.mouse(True)
     pyxel.run(self.update,self.draw)
Esempio n. 4
0
    def __init__(self):
        pxl.init(WIDTH, HEIGHT, fps=FPS)
        pxl.mouse(True)

        self.x, self.y = 1, 1

        pxl.run(self.update, self.draw)
Esempio n. 5
0
    def __init__(self):
        self.game_start = False
        self.game_over = False
        self.game_end = False
        self.game_stop = False
        self.boss = Boss()
        self.boss_enemys = []
        self.boss_flug = False
        self.boss_scr = 0
        self.boss_count = 1
        self.boss_color = 0
        self.score = 0
        self.shots = []
        self.enemys = []
        self.enemys_shots = []
        self.boss_hp = 50
        self.bombs = []
        self.p_ship = Ship()

        pyxel.init(WINDOW_W, WINDOW_H, caption="Pyxel Invaders")
        # Road image file
        pyxel.load("assets/inve.pyxres")

        pyxel.mouse(False)

        pyxel.run(self.update, self.draw)
Esempio n. 6
0
 def __init__(self):
     # запускает pyxel (x, y, название)
     pyxel.init(160, 160, caption='Hello cyberworld 2088 !#@$!@')
     # чтобы курсор не скрывать
     pyxel.mouse(True)
     # вместо while True
     pyxel.run(self.update, self.draw)
Esempio n. 7
0
    def draw(self):
        pyxel.cls(0)
        pyxel.rect(0, 0, 240, 200, 7)
        pyxel.mouse(visible=False)

        self.skier()
        self.trail()
Esempio n. 8
0
    def __init__(self):
        pyxel.init(240, 135, caption="Framework Test", fps=60)
        pyxel.mouse(True)
        
        def obj_next_color(this):
            this.col = (this.col + 1) % 16

        self.page_manager = PageManager([
            Page([
                ObjManager([
                    RectToSlide((10, 10), (20, 20), 11, speed=2),
                    RectToSlide((20, 32), (15, 15), 3, speed=2),
                ]),
                ObjManager([
                    RectToSlide((40, 32), (20, 20), 11, speed=0, click_func=obj_next_color),
                    RectToSlide((50, 10), (15, 15), 3),
                ]),
            ]),
            Page([
                ObjManager([
                    RectToSlide((20, 90), (30, 15), 8),
                ]),
            ]),
        ])

        pyxel.run(self.update, self.draw)
Esempio n. 9
0
    def __init__(self, app):
        self.app = app

        # マップの読み込み
        with open('asset/map.data', "r") as fp:
            self.data = []
            for line in fp:
                row = []
                for c in line:
                    if c == '\n':
                        break
                    row.append(self.MAP2DATA[c])
                self.data.append(row)

        # うさぎ
        self.you = Usagi(self, MAGICIAN, 350, 350)

        # メッセージ
        self.messagebox = ui.MessageBox(pyxel, self.app.font, 5, 174, 245, 48)

        self.targets = [MAGICIAN, CLERIC, HERO, FIGHTER]
        self.current = 0

        self.times = []

        self.messagebox.put(
            "僕たち私達は、画面描画を早くします。早くできたらもっと快適にゲームをプレイできると思います。たくさんたくさんたくさんたくさんたくさん計測して頑張って早くしますね!!ご期待ください。"
        )

        pyxel.mouse(True)
        self.buttons = []
Esempio n. 10
0
 def __init__(self):
     pyxel.init(SCREEN_WIDTH, SCREEN_HEIGHT)
     # shows the mouse
     pyxel.mouse(True)
     self.sandarray = []
     self.Paused = True
     pyxel.run(self.update, self.draw)
Esempio n. 11
0
    def __init__(self):
        pyxel.init(WINDOW_WIDTH, WINDOW_HEIGHT, caption=WINDOW_TITLE, fps=60)
        # pyxel.load(PYXEL_FILE_NAME)
        pyxel.mouse(True)

        self.score = 0
        self.score_before = 0
        with open('score.txt', 'r', encoding="utf-8") as f:
            self.score = int(f.read())

        self.keys_pos = (40, 80)
        self.keys = []
        for yp, l in enumerate(["qwertyuiop", "asdfghjkl", "zxcvbnm"]):
            for xp, char in enumerate(l):
                self.keys.append([char, solve_pos(xp, yp)])
        self.keys.sort()
        self.key_flags = [0]*26

        # self.question_number = 0
        self.before_question = ""
        self.question = ""
        self.answer = ""
        # self.question_i = 0
        self.set_question()

        self.rect_effects = []

        pyxel.run(self.update, self.draw)
Esempio n. 12
0
 def update(self):
     # 選択update
     if self.my_gamemode == GAMEMODE.Title:
         self.update_title()
     elif self.my_gamemode == GAMEMODE.Coin:
         self.update_coin()
         pyxel.mouse(True)
Esempio n. 13
0
    def __init__(self):
        # new Board
        height = math.floor(int(SCREEN_WIDTH / BLOCK_MAX_X) * BLOCK_MAX_Y)
        height += 32
        pyxel.init(SCREEN_WIDTH, height)
        pyxel.mouse(True)

        Block.BLOCK_SIZE = 33

        self.initGame()

        pyxel.load("puzdora.pyxel")

        notes = [
            'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'
        ]

        comboNotes = [n + '3' for n in notes[4:]] + \
            [n + '4' for n in notes]

        for i, note in enumerate(comboNotes):
            pyxel.sound(i).set(note, "T", "6", "F", 20)

        pyxel.sound(20).set("C2C1", "TT", "2", "VV", 2)

        pyxel.run(self.update, self.draw)
Esempio n. 14
0
    def __init__(self):
        pyxel.init(240, 135, fps=60)
        pyxel.mouse(True)

        self.objs = [Rect((20, 20), (30, 30), 3)]

        pyxel.run(self.update, self.draw)
Esempio n. 15
0
    def __init__(self):
        self.game_box = const.SIZE * const.BOX_SIZE
        pyxel.init(self.game_box, self.game_box + const.SCORE_HEIGHT)

        self.selection = None
        pyxel.mouse(True)
        pyxel.run(self.update, self.draw)
Esempio n. 16
0
 def __init__(self):
     #幅と高さを設定して初期化
     pyxel.init(GAME_WIDTH, GAME_HEIGHT, scale=4)
     pyxel.mouse(True)
     self.initializeGameField()
     #ゲーム開始
     pyxel.run(self.update, self.draw)
Esempio n. 17
0
    def __init__(self):
        pyxel.init(240, 135, fps=CONFIG_FPS)
        pyxel.mouse(True)

        self.player = Player(10, 10)

        pyxel.run(self.update, self.draw)
Esempio n. 18
0
    def __init__(self):
        pyxel.init(256, 180, caption="Binary Tree Depth First Search Traversals")
        pyxel.mouse(True)
        pyxel.load("assets/sound_and_images.pyxres")
        pyxel.image(1).load(0, 0, "assets/game_over.png")
        pyxel.image(2).load(0, 0, "assets/winner.jpg")
        self.nodes = []
        self.mode_pre_order = False
        self.mode_in_order = False
        self.mode_post_order = False
        self.list_of_orders = []
        self.index_to_check = -1
        self.num_of_lives = 3
        self.root = None
        self.start_music_game_over = False
        self.start_music_game_won = False
        self.generate_tree()

        pyxel.sound(6).set(
            "r a1b1c2 b1b1c2d2 g2g2g2g2 c2c2d2e2" "f2f2f2e2 f2e2d2c2 d2d2d2d2 g2g2r r ",
            "s",
            "6",
            "nnff vfff vvvv vfff svff vfff vvvv svnn",
            25,
        )

        pyxel.sound(7).set(
            "f0ra4r f0ra4r f0ra4r f0f0a4r", "n", "6622 6622 6622 6422", "f", 25
        )

        pyxel.run(self.update, self.draw)
Esempio n. 19
0
 def update(self):
     # if pyxel.btnp(pyxel.KEY_Q):
     #     pyxel.quit()
     if pyxel.btnp(pyxel.KEY_SPACE):
         self.mouse_visible = not self.mouse_visible
     pyxel.mouse(self.mouse_visible)
     self.active_key_list = [key for key in KEY_LIST if pyxel.btn(key)]
Esempio n. 20
0
    def __init__(self):
        pyxel.init(CONST.WINDOW.WIDTH, CONST.WINDOW.HEIGHT,
                   caption=CONST.WINDOW.TITLE)
        pyxel.load("assets/assets.pyxel")
        pyxel.mouse(True)

        self.buttons = {
            pyxel.GAMEPAD_1_A: PadButton(Vec2(0, 0), 1, radius=4),
            pyxel.GAMEPAD_1_B: PadButton(Vec2(0, 0), 1, radius=4),
            pyxel.GAMEPAD_1_X: PadButton(Vec2(0, 0), 1, radius=4),
            pyxel.GAMEPAD_1_Y: PadButton(Vec2(0, 0), 1, radius=4),
            pyxel.GAMEPAD_1_LEFT_SHOULDER: PadButton(Vec2(0, 0), 0, width=15, height=3),
            pyxel.GAMEPAD_1_RIGHT_SHOULDER: PadButton(Vec2(0, 0), 0, width=15, height=3),
            pyxel.GAMEPAD_1_SELECT: PadButton(Vec2(0, 0), 0, height=3),
            pyxel.GAMEPAD_1_START: PadButton(Vec2(0, 0), 0, height=3),
            pyxel.GAMEPAD_1_UP: PadButton(Vec2(0, 0), 0),
            pyxel.GAMEPAD_1_DOWN: PadButton(Vec2(0, 0), 0),
            pyxel.GAMEPAD_1_LEFT: PadButton(Vec2(0, 0), 0),
            pyxel.GAMEPAD_1_RIGHT: PadButton(Vec2(0, 0), 0),
        }

        GamePadImage.move(CONST.WINDOW.WIDTH // 2,
                          CONST.WINDOW.HEIGHT // 2 + 7)

        self.pad_pos = Vec2(GamePadImage.POS_X,
                            GamePadImage.POS_Y)

        self._set_pos_btns()

        self._current_gamepad = 0

        pyxel.run(self.update, self.draw)
Esempio n. 21
0
 def __init__(self):
     pyxel.init(128, 128)
     self.posicao = Vector2(0, 0)
     pyxel.mouse(True)
     pyxel.load('mapa.pyxres')
     self.tipo_tile = None
     self.jogador = Jogador(Vector2(10, 10), Vector2(0, 1))
     pyxel.run(self.update, self.draw)
    def __init__(self):
        pyxel.init(256, 256)

        pyxel.mouse(True)

        self.points = []

        pyxel.run(self.update, self.draw)
Esempio n. 23
0
    def __init__(self):
        pyxel.init(256, 256, caption="Title", fullscreen=True)
        pyxel.image(1).load(0, 0, "assets/endcard.png")

        pyxel.mouse(True)

        # EVERYTHING MUST BE ABOVE THIS LINE
        pyxel.run(self.update, self.draw)
Esempio n. 24
0
    def __init__(self):
        pyxel.init(SCREEN_WIDTH, SCREEN_HEIGHT, caption="Pyxel Bubbles")
        pyxel.mouse(True)

        self.is_exploded = False
        self.bubbles = [Bubble() for _ in range(BUBBLE_INITIAL_COUNT)]

        pyxel.run(self.update, self.draw)
Esempio n. 25
0
    def __init__(self):
        pyxel.init(128, 128, caption="MYST")
        #
        pyxel.load('assets/myst.pyxres')

        pyxel.mouse(False)

        pyxel.run(self.update, self.draw)
 def __init__(self):
     pyxel.mouse(True)
     self.__stone = StoneType.White
     self.__candidates = []  # 石を置けるマスの候補(マス座標)
     self.__reverses = []  # めくる敵石(マス座標)
     self.__pass_count = 0
     self.__mouse_pos = [0, 0]
     self.__flash_wait = 60
Esempio n. 27
0
    def __init__(self):
        pyxel.init(256, 256, caption="endofday", fullscreen=True)
        pyxel.image(0).load(0, 0, "assets/morning.jpg")

        pyxel.mouse(True)

        # EVERYTHING MUST BE ABOVE THIS LINE
        pyxel.run(self.update, self.draw)
Esempio n. 28
0
 def __init__(self):
     pyxel.init(200, 200)
     pyxel.mouse(True)
     self.bolas = []
     self.ponto_clique = None
     self.gravidade = 1
     self.coeficiente_restituicao = 0.9
     pyxel.run(self.update, self.draw)
Esempio n. 29
0
 def __init__(self):
     self.player = self.Player(72, 100)
     self.enemies = self.EnemyManagement()
     self.ret = self.Rectb()
     pyxel.init(144, 120, caption="Jam",fps=60)
     pyxel.load("assets/my_resource.pyxres")
     pyxel.mouse(True)
     pyxel.run(self.update, self.draw)
Esempio n. 30
0
 def __init__(self):
     pyxel.init(SCREEN_WIDTH, SCREEN_HEIGHT, scale=SCALE)
     # shows the mouse
     pyxel.mouse(True)
     self.Paused = True
     #self.player = Pixel(int(SCREEN_WIDTH/2),int(SCREEN_HEIGHT/2),PLAYER)
     #self.destination = Pixel(int(SCREEN_WIDTH/2),int(SCREEN_HEIGHT/2),DESTINATION)
     pyxel.run(self.update, self.draw)