Beispiel #1
0
    def __init__(self):
        pyxel.init(250, 200, fps=60)

        # initialize the map
        self.map = Map()
        # Whether you explored the positon or not.
        self.visited = [
            [False]*self.map.MAP_WIDTH for _ in range(self.map.MAP_HEIGHT)]

        # Get a player's position
        self.x, self.y = self.map.search_map(self.ID["player"])
        self.visit_around()

        # Get a goal's position
        self.gx, self.gy = self.map.search_map(self.ID["goal"])
        pyxel.load("asset.pyxres")

        self.START_TIME = time.time()
        pyxel.run(self.update, self.draw)
Beispiel #2
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 #3
0
    def __init__(self):
        p.init(240, 135, caption="Timber Practice", fps=60)
        p.load("assets/my_resource.pyxres")
        p.mouse(True)

        if os.path.isfile("tree_queue_pattern.pyc"):
            # print("yes")
            with open("tree_queue_pattern.pyc", "rb") as f:
                self.tree_queue_pattern = pickle.load(f)
        else:
            # self.tree_queue_pattern = [0, 1, 0, 2]
            self.tree_queue_pattern = [
                0, 1, 1, 0, 2, 2, 0, 1, 0, 2, 2, 0, 1, 1, 0, 2
            ]
        self.start_game()
        self.is_setting = False
        self.tree_y_adjust = 0

        p.run(self.update, self.draw)
Beispiel #4
0
    def __init__(self):
        pyxel.init(160, 120, caption="Pyxel Jump")

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

        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)

        pyxel.run(self.update, self.draw)
Beispiel #5
0
    def __init__(self):
        pyxel.init(160, 120, caption="Pyxel Jump Game")

        pyxel.image(0).load(0, 0, "assets/jump_game_160x120.png")

        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)]

        # bgm
        a = "c3e2g2c3 e2g2c3e2"
        b = "c3d2g2c3 d2g2c3d2"
        pyxel.sound(0).set(a * 3 + b * 1, "t", "2", "f", 30)

        a = "g1c2d2e2 e2e2f2f2"
        b = "e2e2e2c2 c2c2c2c2"
        c = "g2g2g2d2 d2d2d2d2"
        pyxel.sound(1).set(a + b + a + c, "s", "4", "nnnn vvnn vvff nvvf", 30)

        pyxel.sound(2).set("c1c1f0f0a0a0g0g0", "p", "4", "nf", 120)

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

        # jump sound
        pyxel.sound(3).set("g1a#1d#2b2", "s", "7654", "s", 9)

        # eat sound
        pyxel.sound(4).set("g1c2f2a2c#2f#3", "p", "6", "s", 4)

        # fall sound
        pyxel.sound(5).set("a3d#3a#2f#2d2b1g1d#1", "s", "77654321", "s", 10)

        pyxel.run(self.update, self.draw)
Beispiel #6
0
    def __init__(self):
        pyxel.init(width=189,
                   height=252,
                   caption="shooting",
                   fps=60,
                   border_width=0)
        self.one_second_count = 0
        self.fps_base_time = time.time()
        self.fps = 0
        self.scene_manager = scene_manager.SceneManager()
        # 記録用ファイルがない場合は起動時に作成
        if not os.path.exists("score.txt"):
            with open("score.txt", "wt") as f:
                for mission_number in range(0, 21):
                    f.writelines(
                        str(mission_number) + "," + "0" + "," + "0" + "," +
                        "0" + "\n")

        pyxel.run(self.update, self.draw)
Beispiel #7
0
    def __init__(self):
        self.IMG_ID0_X = 60
        self.IMG_ID0_Y = 65
        self.IMG_ID0 = 0
        self.IMG_ID1 = 1
        # self.IMG_ID2 = 2

        pyxel.init(WINDOW_W, WINDOW_H, fps=FPS, caption="Hello Pyxel")
        pyxel.image(self.IMG_ID0).load(0, 0, "assets/pyxel_logo_38x16.png")
        pyxel.image(self.IMG_ID1).load(0, 0, "assets/cat_16x16.png")

        pyxel.mouse(True)

        # make instance
        self.Cats = []
        self.Springs = []
        self.ceiling = Ceiling()

        pyxel.run(self.update, self.draw)
Beispiel #8
0
 def __init__(self):
     pyxel.init(consts.SCREEN_WIDTH,
                consts.SCREEN_HEIGHT,
                caption='PyPong',
                scale=consts.SCALE)
     self.state = 'start'
     self.single_player = True
     self.table = Table()
     self.start_menu = Menus(consts.START_SCREEN)
     self.controls_menu = Controls(consts.CONTROLS_SCREEN_OPTIONS)
     self.bot_menu = Menus(consts.BOT_SCREEN_OPTIONS)
     self.pause_menu = Menus(consts.PAUSE_SCREEN_OPTIONS)
     self.win_screen = Win(consts.WIN_SCREEN)
     self.first_paddle = Paddle(player=1)
     self.second_paddle = Paddle(player=2)
     self.ball = Ball(x_direction_right=True)
     self.score_time = 0
     self.winner = None
     pyxel.run(self.update, self.draw)
Beispiel #9
0
    def __init__(self):
        self.width = 160
        self.height = 120
        pyxel.init(self.width, self.height)

        self.num_elevators = 5
        self.idx = 0
        self.elevators = Elevators(self.num_elevators, self.width, self.height)
        self.cat = Cat(0, 0)
        self.score_text = "Score {:05d}"

        pyxel.sound(3).set("g1a#1d#2b2", "s", "7654", "s", 9)
        pyxel.sound(4).set("g1c2f2a2c#2f#3", "p", "6", "s", 4)
        pyxel.sound(5).set("a3d#3a#2f#2d2b1g1d#1", "s", "77654321", "s", 10)

        pyxel.image(0).load(0, 0, "assets/cat_16x16.png")

        self.play_bgm()
        pyxel.run(self.update, self.draw)
Beispiel #10
0
    def __init__(self, resoure_file, app_file):
        pyxel.init(SCREEN_WIDTH, SCREEN_HEIGHT, caption='pyxel')

        self._root_widget = Widget(None, 0, 0, 0, 0)

        self._screen_list = [
            Console(self._root_widget),
            ImageEditor(self._root_widget),
            TileMapEditor(self._root_widget),
            SoundEditor(self._root_widget),
            MusicEditor(self._root_widget),
        ]

        self._screen_button = RadioButton(self._root_widget, 3, 1, 5, 1, 9)
        self._screen_button.add_event_handler(
            'change', lambda index: self.set_screen(index))
        self.set_screen(1)

        pyxel.run(self.update, self.draw)
    def __init__(self):
        self.logger = logging.getLogger(__name__)

        self.logger.info("Starting game...")

        pyxel.init(256, 256, caption="Air hockey", scale=8, fps=40)
        self.initValues()
        self.initSound()

        # Scores are per game, not per round
        self.p1Score = 0
        self.p2Score = 0

        self.p1KeyUp = pyxel.KEY_W
        self.p1KeyDown = pyxel.KEY_S
        self.p2KeyUp = pyxel.KEY_UP
        self.p2KeyDown = pyxel.KEY_DOWN

        pyxel.run(self.update, self.draw)
 def __init__(self):
     pyxel.init(200, 200)
     pyxel.load('breakout2.pyxel')
     self.vidas = 3
     self.coracoes = [True] * self.vidas
     self.raio = 3
     self.modo = PARADO
     self.debug = False
     self.pad_l = 50
     self.pad_a = 6
     self.pad_offset = 7
     self.p_sup_esq = None
     self.p_inf_esq = None
     self.p_sup_dir = None
     self.p_inf_dir = None
     self.pad_vel = 0
     self.pos_anterior_bola = None
     self.resetar_posicoes()
     pyxel.run(self.atualizar, self.desenhar)
Beispiel #13
0
 def __init__(self, debug=False):
     global map_size
     self.enemies = [
         Enemy(random.randint(25, 50), random.randint(25, 50)),
         Enemy(random.randint(25, 50),
               random.randint(map_size - 50, map_size - 25)),
         Enemy(random.randint(map_size - 50, map_size - 25),
               random.randint(25, 50)),
         Enemy(random.randint(map_size - 50, map_size - 25),
               random.randint(map_size - 50, map_size - 25))
     ]
     self.projectiles = []
     self.player = Player()
     self.debug = debug
     self.frame = 60  #start at 60 or -1
     self.run = False
     pyxel.init(map_size, map_size, caption="mini-project", fps=60)
     pyxel.load("test.pyxres")
     pyxel.run(self.update, self.draw)
Beispiel #14
0
    def __init__(self):
        pyxel.init(160, 120, caption='Pyxel Jump Game')

        pyxel.image(0).load(0, 0, 'assets/jump_game_160x120.png')

        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)]

        # bgm
        a = 'c3e2g2c3 e2g2c3e2'
        b = 'c3d2g2c3 d2g2c3d2'
        pyxel.sound(0).set(a * 3 + b * 1, 't', '2', 'f', 30)

        a = 'g1c2d2e2 e2e2f2f2'
        b = 'e2e2e2c2 c2c2c2c2'
        c = 'g2g2g2d2 d2d2d2d2'
        pyxel.sound(1).set(a + b + a + c, 's', '4', 'nnnn vvnn vvff nvvf', 30)

        pyxel.sound(2).set('c1c1f0f0a0a0g0g0', 'p', '4', 'nf', 120)

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

        # jump sound
        pyxel.sound(3).set('g1a#1d#2b2', 's', '7654', 's', 9)

        # eat sound
        pyxel.sound(4).set('g1c2f2a2c#2f#3', 'p', '6', 's', 4)

        # fall sound
        pyxel.sound(5).set('a3d#3a#2f#2d2b1g1d#1', 's', '77654321', 's', 10)

        pyxel.run(self.update, self.draw)
 def __init__(self):
     pyxel.init(SCREEN_WIDTH, SCREEN_HEIGHT)
     self.x = 80
     self.y = 60
     pyxel.playm(0, loop=True)
     self.boosty = 1.2343
     self.side_scroll_y = 30
     self.score = 0
     self.mus = 1
     self.fuel = 100
     self.minusfuel = 1
     self.gravity = 0.5120
     self.fuelx = 40
     self.stop = False
     self.fuely = 40
     pyxel.load('2ndboi.pyxres')
     pyxel.playm(0, loop=True)
     pyxel.run(self.update, self.draw)
     self.make_fuel = False
Beispiel #16
0
    def __init__(self, width=100, height=600):

        pyxel.init(WIDTH, HEIGHT, caption="GODGAME")
        pyxel.load("sprites.pyxres")

        self.ore = 50

        self.energy = 10
        self.bits = [Tank(100, 100)]
        self.scenary = [
            Ore(randint(0, GAME_WIDTH), randint(0, HEIGHT)) for i in range(5)
        ]
        self.scenary += [
            Ore(randint(-5000, 5000), randint(-5000, 5000)) for i in range(500)
        ]
        self.buildings = [Home(WIDTH // 2, HEIGHT // 2, pre_built=True)]
        self.buildings.append(Home(300, 300, pre_built=True, tribe=PLAYER_2))
        self.bit_selection = None
        self.selected_bits = []
        self.cursor = "."
        self.enemy_objects = self.bits
        self.being_built = []
        self.icons = OrderedDict()
        self.left, self.right, self.up, self.down = False, False, False, False
        self.view_x_move = 0
        self.view_y_move = 0
        self.mazes = []

        for object in IMPLEMENTED_BUILDINGS:
            self.icons.update({
                object.symbol: {
                    "y": 0,
                    "constructor": object,
                    "type": object.build_type
                }
            })

        prep_music()
        pyxel.playm(0, loop=True)

        pyxel.run(self.process_events, self.draw)
        pyxel.mouse(True)
Beispiel #17
0
    def __init__(self):
        pyxel.init(120, 160, caption="Pyxel Shooter")

        pyxel.image(0).set(
            0,
            0,
            [
                "00c00c00",
                "0c7007c0",
                "0c7007c0",
                "c703b07c",
                "77033077",
                "785cc587",
                "85c77c58",
                "0c0880c0",
            ],
        )

        pyxel.image(0).set(
            8,
            0,
            [
                "00088000",
                "00ee1200",
                "08e2b180",
                "02882820",
                "00222200",
                "00012280",
                "08208008",
                "80008000",
            ],
        )

        pyxel.sound(0).set("a3a2c1a1", "p", "7", "s", 5)
        pyxel.sound(1).set("a3a2c2c2", "n", "7742", "s", 10)

        self.scene = SCENE_TITLE
        self.score = 0
        self.background = Background()
        self.player = Player(pyxel.width / 2, pyxel.height - 20)

        pyxel.run(self.update, self.draw)
Beispiel #18
0
    def __init__(self, resource_file):
        resource_file = os.path.join(os.getcwd(), resource_file)
        root, ext = os.path.splitext(resource_file)
        if ext != ".pyxel":
            resource_file += ".pyxel"

        pyxel.init(
            EDITOR_WIDTH,
            EDITOR_HEIGHT,
            caption="Pyxel Editor - {}".format(resource_file),
        )

        try:
            pyxel.load(resource_file)
        except FileNotFoundError:
            pass

        self._resource_file = resource_file
        self._root_widget = Widget(None, 0, 0, 0, 0)

        self._screen_list = [
            ImageEditor(self._root_widget),
            TileMapEditor(self._root_widget),
            SoundEditor(self._root_widget),
            MusicEditor(self._root_widget),
        ]

        self._screen_button = RadioButton(self._root_widget, 3, 1, 3, 3, 13, 4)
        self._screen_button.add_event_handler(
            "change", lambda value: self.set_screen(value))
        self.set_screen(0)

        self._undo_button = ImageButton(self._root_widget, 48, 1, 3, 48, 13)
        self._undo_button.add_event_handler("press", self.__on_undo_press)

        self._redo_button = ImageButton(self._root_widget, 57, 1, 3, 57, 13)
        self._redo_button.add_event_handler("press", self.__on_redo_press)

        self._save_button = ImageButton(self._root_widget, 75, 1, 3, 75, 13)
        self._save_button.add_event_handler("press", self.__on_save_press)

        pyxel.run(self.update, self.draw)
Beispiel #19
0
    def __init__(self):
        pyxel.init(240, 240, caption='Bourne Again', fps=30)
        pyxel.mouse(True)

        pyxel.load('stuff.pyxres')

        self.seemsg = ''
        self.seemsg_iter = ''
        self.seemsg_out = ''

        self.player = Player(30, 120)

        self.beam_angle = None
        self.inputed_angle = None
        self.beam_start_time = 0

        #self.wll_index = 0

        self.targets = {
            'A': Target(200, 120, 'Target A feels lonely'),
            'B': Target(1, 20, 'Fortune awaits Target B'),
            'C': Target(120, 199, 'Target C is in the mood for shawarma')
        }

        self.walls = [Solid(150, 120), Solid(100, 45), Solid(24, 200)]

        self.flag = Flag(60, 24)

        self.powerup = Powerup(80, 120)

        self.upgraded = False
        self.blocked_functions = ['up', 'down', 'left']

        self.locked = False
        self.has_won = False

        self.raycast_distance = 0
        self.raycast_has_collided = False

        pyxel.playm(1, loop=True)

        pyxel.run(self.update, self.draw)
Beispiel #20
0
    def __init__(self, model, **kwargs):
        self.start_coords = kwargs.pop('start_coords', {})
        self.discount = kwargs.pop('discount', 0.1)
        self.max_memory = kwargs.pop('max_memory', 10)
        self.num_epochs = kwargs.pop('num_epochs', 100)
        self.data_size = kwargs.pop('data_size', 50)
        self.epsilon = kwargs.pop('epsilon', 1.0)
        self.final_epsilon = kwargs.pop('final_epsilon', 0.1)
        self.lr_rate = kwargs.pop('lr_rate', 0.1)
        self.model_num_epochs = kwargs.pop('model_num_epochs', 8)
        self.model_batch_size = kwargs.pop('model_batch_size', 16)
        self.reward_dict = kwargs.pop('reward_dict', None)
        self.min_reward = kwargs.pop('min_reward', -0.5 * 20)
        self.min_reward_decay = kwargs.pop('min_reward_decay', None)
        self.verbose = kwargs.pop('verbose', True)
        exploration_steps = kwargs.pop('exploration_steps', 1000)

        self.free_play = kwargs.pop('free_play', False)

        if self.reward_dict is None:
            raise ValueError('Please specify a reward dictionary')

        self.shape = (48, 48)
        self.goal = self.start_coords['goal']
        self.play = True
        self.epsilon_step = (self.epsilon -
                             self.final_epsilon) / exploration_steps

        self.model = model
        self.experience = Experience(self.model,
                                     alpha=self.lr_rate,
                                     max_memory=self.max_memory,
                                     discount=self.discount)

        self._reset()
        pyxel.init(64, 64, caption='soko')
        pyxel.load('soko2.pyxres')
        # pyxel.sound(0)
        if self.free_play:
            pyxel.run(self.update_simple, self.draw)
        else:
            pyxel.run(self.update, self.draw)
Beispiel #21
0
def main():
    global list_render
    global list_laser
    global list_crash
    global list_enemy

    pyxel.init(SCREEN_W, SCREEN_H)
    pyxel.mouse(True)

    while True:
        pyxel.cls(0)

        if pyxel.btn(pyxel.MOUSE_LEFT_BUTTON):
            o = CLaser(Vector2(random.randint(0, SCREEN_W), SCREEN_W))
            list_laser.append(o)

        o = CEnemy(Vector2(random.randint(0, SCREEN_W), -CEnemy.SIZE))
        list_enemy.append(o)

        for o in list_enemy:
            o.update()

        for o in list_laser:
            o.set_target(Vector2(pyxel.mouse_x, pyxel.mouse_y))
            o.update()

        for o in list_crash:
            o.update()

        [o.render() for o in list_render]

        pyxel.text(8, 8, "Render(s) {:4d}".format(len(list_render)), 7)
        pyxel.text(8, 16, "Enemy(s)  {:4d}".format(len(list_enemy)), 7)
        pyxel.text(8, 24, "Laser(s)  {:4d}".format(len(list_laser)), 7)
        pyxel.text(8, 32, "Crash(s)  {:4d}".format(len(list_crash)), 7)

        list_enemy = [o for o in list_enemy if o.enable is True]
        list_laser = [o for o in list_laser if o.enable is True]
        list_crash = [o for o in list_crash if o.enable is True]
        list_render = []

        pyxel.flip()
    def __init__(self):
        pyxel.init(255, 255, caption="MOONSHOT", quit_key=pyxel.KEY_ESCAPE, fps=20)
        pyxel.image(0).load(0, 0, "assets/object.png")

        # Objects generation with random position
        self.list_object = []
        for _ in range(0, 20): self.list_object.append(Petit_Roc(randint(0, 255), randint(0, 255), 72, 16, 16, 8))
        for _ in range(0, 10): self.list_object.append(Moyen_Roc(randint(0, 255), randint(0, 255), 72, 24, 16, 8))
        for _ in range(0, 5): self.list_object.append(Grand_Roc(randint(0, 255), randint(0, 255), 0, 0, 16, 16))

        # Enemies
        self.enemies = []
        self.enemies_level = 1

        # Projectiles
        self.projectiles = []
        self.explosions = []

        # Orb
        self.orb = []

        # Teleport
        self.teleport = Teleport(randint(0, 255), randint(0, 255))
        
        # Read File informations
        self.stats = {}
        with open('resource/statistics.json', 'r') as stats:
            json_stats = json.load(stats)
            self.stats["level_player"] = int(json_stats["level_player"])
            self.stats["life"] = int(((self.stats["level_player"]/10)+(self.stats["level_player"]/2)+(self.stats["level_player"]*10))*json_stats["bonus_life"])
            self.stats["bonus_life"] = json_stats["bonus_life"]
            self.stats["damage"] = int((((self.stats["level_player"]*50)/10)+(self.stats["level_player"]/2)-(self.stats["level_player"]/5))*json_stats["bonus_attack"])
            self.stats["bonus_attack"] =json_stats["bonus_attack"]
            self.stats["bonus_defense"] =json_stats["bonus_defense"]
            self.stats["bonus_range"] =json_stats["bonus_range"]
            self.stats["experience"] = int(json_stats["experience"])

        # Player
        self.player = Player(randint(0, 255), randint(0, 255), self.stats["life"], self.stats["level_player"], self.stats["damage"], self.stats["experience"])

        self.in_game = True
        pyxel.run(self.update, self.draw)
    def __init__(self):
        pyxel.init(250, 170, caption="SET OPERATIONS")
        self.head = "Random Sets Operations"
        self.op1 = ">>> Press [N] to generate 2 new random Set"
        self.op2 = ">>> Press [U] to see the Union"
        self.op3 = ">>> Press [I] to see the Intersection"
        self.op4 = ">>> Press [D] to see the Difference"
        self.op5 = ">>> Press [S] to see the Symmetric Difference"
        self.sets = randomsets()
        self.uni = self.sets.union()
        self.inter = self.sets.intersection()
        self.diff = self.sets.difference()
        self.symmdiff = self.sets.symm_diff()
        self.u = 0
        self.i = 0
        self.d = 0
        self.s = 0


        pyxel.run(self.update, self.draw)
Beispiel #24
0
    def __init__(self):
        pyxel.init(200, 200, caption='COLLISION')

        self.iniciox = 100
        self.inicioy = 188
        self.x = 30
        self.x2 = 30
        self.x3 = 30
        self.y = 0
        self.y2 = 0
        self.y3 = 0
        self.direcao = 4
        self.tamanho_sprite = 30
        self.largura = 16
        self.altura = 12
        self.colidiu = False
        self.colisao = 0
        self.start = 0

        pyxel.run(self.update, self.draw)
Beispiel #25
0
    def __init__(self):
        pyxel.init(256,
                   256,
                   fps=60,
                   caption="Ruby eats poo",
                   border_width=16,
                   border_color=8,
                   scale=4)

        self.env = Env()
        self.sound = SoundEffects(self.env)
        self.scene = Drawable()
        self.scene.elements.append(Blocks(self.env))
        self.scene.elements.append(Player(self.env))
        self.scene.elements.append(Foods(self.env))
        self.scene.elements.append(Score(self.env))

        self.env.eventloop.send(EVENT_GAME_START)

        pyxel.run(self.update, self.draw)
Beispiel #26
0
    def __init__(self):
        pyxel.init(
            *(240, 135),
            caption="ui test",
            fps=60,
        )
        pyxel.mouse(True)

        # rect_1
        self.rect_1_col = 1
        # rect_2
        self.rect_2_is_draw = False
        self.rect_2_index = 0
        self.rect_2_x = 0
        self.rect_2_y = 0
        self.rect_2_w = 0
        self.rect_2_h = 0
        self.rect_2_col = 3

        pyxel.run(self.update, self.draw)
Beispiel #27
0
    def __init__(self):
        pyxel.init(255, 255)
        self.x = 0
        self.time_begin = 1555749269.0

        self.icon = {}
        # ImageLoaderを利用したアイコンの登録
        self.icon["mihon"] = actor.Actor(20, 80)
        self.icon["mihon"].imageload("images/search1_8.png")
        self.icon["mihon2"] = actor.Actor(40, 80)
        self.icon["mihon2"].imageload("images/search2_8.png")
        #self.icon["mihon"].imageload("images/mihon.png")
        self.icon["arrow"] = actor.Actor(20, 40)
        self.icon["arrow"].imageload("images/arrow1_up_8.png")
        self.icon["arrow2"] = actor.Actor(40, 40)
        self.icon["arrow2"].imageload("images/arrow2_up_8.png")

        pyxel.mouse(True)

        pyxel.run(self.update, self.draw)
Beispiel #28
0
    def __init__(self):
        self.IMG_ID0_X = 60
        self.IMG_ID0_Y = 65
        self.IMG_ID0 = 0
        self.IMG_ID1 = 1
        # self.IMG_ID2 = 2
 
        pyxel.init(WINDOW_W, WINDOW_H, fps = FPS, caption="Hello Pyxel")
        pyxel.image(self.IMG_ID0).load(0, 0, "pyxel_logo_38x16.png")
        pyxel.image(self.IMG_ID1).load(0, 0, "cat_16x16.png")
 
        pyxel.mouse(True)
 
        # make instance
        self.Cats = []
        self.ground = Ground()
 
        # self.mouse_count = 0
 
        pyxel.run(self.update, self.draw)
Beispiel #29
0
    def __init__(self, fps=BASE_FPS, speed=1.0):
        pyxel.init(256, 256, caption="Pyxel Toomy", fps=fps)

        # Load all the images and sounds used in the game
        pyxel.load("assets/toomy_game.pyxres")

        self.__speed = speed
        self._fps = fps

        # Factor to keep things running normally at different fps / speeds
        self._frame_step = speed * BASE_FPS / fps

        # number of frames that would have happened so far at current speed/fps
        # (adjusted when speed changes to keep things rendering at the same spot)
        self.frame_count = 0

        # Seconds of 1x-speed game time since game start
        self.game_time = 0.0

        # Player info
        self.score = 0
        self.player_x = 72
        self.player_y = 25
        self.player_vy = 0
        self.player_is_alive = True

        # Define the stuff on screen
        self.far_cloud = [(-10, 75), (40, 65), (90, 60)]
        self.near_cloud = [(10, 25), (70, 35), (120, 15)]
        self.floor = [
            Floor(randint(0, 200 // BLOCK_SIZE), randint(8, 16), True,
                  randint(1, 10), 1) for i in range(5)
        ]
        self.fruit = [(i * 60, randint(40, 104), randint(0, 3), True)
                      for i in range(5)]

        # Start playing music (sound #0)
        pyxel.playm(0, loop=True)

        # Run the game (update/draw loop)
        pyxel.run(self.update, self.draw)
Beispiel #30
0
    def __init__(self, resoure_file, app_file):
        pyxel.init(SCREEN_WIDTH, SCREEN_HEIGHT, caption='pyxel')

        self._root_widget = Widget(None, 0, 0, 0, 0)

        self._screen_list = [
            Console(self._root_widget),
            ImageEditor(self._root_widget),
            TileMapEditor(self._root_widget),
            SoundEditor(self._root_widget),
            MusicEditor(self._root_widget),
        ]
        self._screen_button = RadioButton(self._root_widget, 3, 1, 5, 1, 9)

        def on_value_change(value):
            self.set_screen(value)

        self._screen_button.on_value_change = on_value_change
        self.set_screen(1)

        pyxel.run(self.update, self.draw)