Пример #1
0
def main() -> None:
    screen_width, screen_height = [
        int(0.8 * dim) for dim in arcade.get_display_size()
    ]
    app = Application(width=screen_width,
                      height=screen_height,
                      title="Space4X")
    app.setup()
    arcade.run()
Пример #2
0
    def center_window(self):
        """
        Center the window on the screen.
        """
        # Get the display screen using pyglet
        screen_width, screen_height = get_display_size()

        window_width, window_height = self.get_size()
        # Center the window
        self.set_location((screen_width - window_width) // 2, (screen_height - window_height) // 2)
Пример #3
0
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.bouncing_balls
"""

import arcade
import random
import numpy

from palettable.scientific.diverging import Roma_18_r as cmap

from gas import *

# --- Set up the constants

# Size of the screen
(w, h) = arcade.get_display_size()
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600
SCREEN_TITLE = "Bouncing Balls Example"


class MyGame(arcade.Window):
    """ Main application class. """
    def __init__(self):
        super().__init__(SCREEN_WIDTH,
                         SCREEN_HEIGHT,
                         SCREEN_TITLE,
                         resizable=True)
        self.box = Box([SCREEN_WIDTH, SCREEN_HEIGHT])
        self.box.field = Field(self.box)
        self.box.field.field = self.box.field.rotate
Пример #4
0
import arcade
import arcade.gui
import random
from lab_generator import create_way
import math
import time

s_w, s_h = arcade.get_display_size()
ms = 2
turn_s = 1

BLACK = arcade.color.BLACK
WHITE = arcade.color.WHITE
GRAY = arcade.color.GRAY
RED = arcade.color.RED


class Portal(arcade.Sprite):
    def __init__(self):
        super(Portal, self).__init__()
        self.all_textures = []
        self.frame = 0
        self.scale = 0.4
        for i in range(1, 5):
            self.all_textures.append(arcade.load_texture(f"portal_{i}.png"))

        self.texture = self.all_textures[0]

    def update_animation(self, delta_time: float = 1 / 60):
        self.frame += 0.1
        self.texture = self.all_textures[int(self.frame) % 4]
Пример #5
0
from palettable.scientific.diverging import Roma_20_r as colormap
# from palettable.mycarta import CubeYF_20 as colormap

from gas import *  # pylint: disable=wildcard-import, unused-wildcard-import
from setupbox import Setup, ArrangeParticles

# Set up the constants
ASK_LOAD = False

UPDATE_RATE = 1 / 60
TEXT_REFRESH = 10
TICK_RATE = 1
ROTATION = 2 * math.pi * 15 / 360

# Size of the screen
(DISPLAY_WIDTH, DISPLAY_HEIGHT) = arcade.get_display_size()
SCREEN_WIDTH = 1000  # DISPLAY_WIDTH
SCREEN_HEIGHT = 900  # DISPLAY_HEIGHT - 100
DEPTH = DISPLAY_HEIGHT  # 500
D4 = 500
D5 = 400
SCREEN_TITLE = "Bouncing Balls Example"

# Use change in Sprites alpha value for 3rd dimension
DALPHA = Box.Z
# Use change in Sprites size for 4th dimension
DSIZE = Box.D4

# Physical contants
BOX_DIMENSIONS = [SCREEN_WIDTH, SCREEN_HEIGHT, DEPTH, D4, D5]
BALLS = 6
Пример #6
0
import arcade
import random
import time

SCREEN_WIDTH, SCREEN_HEIGHT = arcade.get_display_size()
ms = 4
run_ms = 8


def load_texture(filename):
    return [
        arcade.load_texture(filename),
        arcade.load_texture(filename, flipped_horizontally=True)
    ]


class PlayerCharacter(arcade.Sprite):
    def __init__(self):
        super(PlayerCharacter, self).__init__()
        self.stay_textures = []
        self.walk_textures = []
        self.atack_textures = []
        self.die_textures = []
        self.center_y = SCREEN_HEIGHT / 2
        self.atack_range = 25
        self.jump_texture = None
        self.atacked_jump_texture = None
        self.cur_texture = 0
        self.player_face_direction = 0
        self.atack = False
        self.damaged = False