Changement des chemins d'accès pour les images

This commit is contained in:
DotoroIII 2024-03-09 12:53:51 +01:00
parent 2f401aeb71
commit b237bd7485
2 changed files with 14 additions and 7 deletions

View File

@ -1,11 +1,13 @@
import turtle
import os.path
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
# Cell size
distance = 90
def start():
# Set background - ocean
turtle.bgpic("background.png")
turtle.bgpic(f"{CURRENT_PATH}/background.png")
# Set turtle cusor
turtle.pensize(10)

View File

@ -5,7 +5,7 @@ ressources : https://api.arcade.academy/en/latest/resources.html
import arcade
import cubito
import os.path
SCREEN_MULTILPLIER = 1.5
SCREEN_MULTILPLIER /= 4
@ -22,6 +22,9 @@ TOKEN_ROW = 10
TOKEN_HEIGHT = int(160 * SCREEN_MULTILPLIER)
TOKEN_WIDTH = int(160 * SCREEN_MULTILPLIER)
# Token scale
HELD_TOKEN_SCALE_MULTILPLIER = 4 * SCREEN_MULTILPLIER
# Space between tokens
X_SPACING_TOKEN = int(45*SCREEN_MULTILPLIER + TOKEN_WIDTH)
Y_SPACING_TOKEN = int(45*SCREEN_MULTILPLIER + TOKEN_HEIGHT)
@ -30,9 +33,6 @@ Y_SPACING_TOKEN = int(45*SCREEN_MULTILPLIER + TOKEN_HEIGHT)
X_TOKEN_START = int(108*SCREEN_MULTILPLIER + TOKEN_WIDTH / 2)
Y_TOKEN_START = int(1618*SCREEN_MULTILPLIER + TOKEN_HEIGHT / 2)
# Token scale
HELD_TOKEN_SCALE_MULTILPLIER = 4 * SCREEN_MULTILPLIER
print(HELD_TOKEN_SCALE_MULTILPLIER)
# List of token types
TOKEN_TYPES = ["up", "left", "right", "function"]
@ -64,6 +64,9 @@ Y_START_FUNCTION_MAT_IMAGE = 393 * SCREEN_MULTILPLIER
# Couleur
BACKGROUND_COLOR = (133, 100, 100)
CURRENT_PATH = os.path.dirname(os.path.realpath(__file__))
class Start_mat(arcade.SpriteSolidColor):
def __init__(self, height, width, color=arcade.color.AMBER):
super().__init__(width, height, color)
@ -83,13 +86,15 @@ class Token_sprite(arcade.Sprite):
# Attributes for token type
self.token_type = token_type
scale *= SCREEN_MULTILPLIER
self.image_file_name = f"Img/token/{self.token_type}.png"
self.image_file_name = f"{CURRENT_PATH}/Img/token/{self.token_type}.png"
# Call the parent
super().__init__(self.image_file_name, scale, hit_box_algorithm="None")
class Image(arcade.Sprite):
def __init__(self, file_name, scale=1):
self.image_file_name = f"Img/{file_name}"
self.image_file_name = f"{CURRENT_PATH}/Img/{file_name}"
scale *= SCREEN_MULTILPLIER
# Call the parent
super().__init__(self.image_file_name, scale, hit_box_algorithm="None")