The window and JacoVirt-Bot in Arcade is display

This commit is contained in:
mdl29 2024-04-24 15:00:15 +02:00
parent c1d3ac28e5
commit 65f2c316cf
17 changed files with 46 additions and 33 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -1,35 +1,35 @@
"""
Sprite Collect Coins with Background
Simple program to show basic sprite usage.
Artwork from https://kenney.nl
If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.sprite_collect_coins_background
"""
import random
import arcade
import os
PLAYER_SCALING = 1.5
COIN_SCALING = 0.75
PLAYER_SCALING = 1.1
COIN_SCALING = 0.9
SCREEN_WIDTH = int(600*1.5)
SCREEN_HEIGHT = int(600*1.5)
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600
SCREEN_TITLE = "Sprite Collect Coins with Background Example"
#DISTANCE = 100
class MyGame(arcade.Window):
"""
Main application class.
"""
def __init__(self, width, height, title):
""" Initializer """
with resources.path("jacovirt", 'Img') as img_folder :
self.background = str(img_folder/ "Background_dark.png")
self.player_sprite = arcade.Sprite("Img/Cubetto_forme_droite_dark.gif", PLAYER_SCALING)
distance = 84
posxstart = -211
posystart = 194
# Call the parent class initializer
super().__init__(width, height, title)
@ -41,6 +41,7 @@ class MyGame(arcade.Window):
os.chdir(file_path)
# Background image will be stored in this variable
self.background = None
# Variables that will hold sprite lists
self.player_list = None
@ -67,26 +68,31 @@ class MyGame(arcade.Window):
# Sprite lists
self.player_list = arcade.SpriteList()
self.coin_list = arcade.SpriteList()
#self.coin_list = arcade.SpriteList()
# Set up the player
self.score = 0
self.player_sprite = arcade.Sprite("Img/Cubetto_forme_droite_dark.gif",
PLAYER_SCALING)
self.player_sprite.center_x = 50
self.player_sprite.center_y = 50
self.player_list.append(self.player_sprite)
for i in range(50):
"""
for i in range(3):
# Create the coin instance
coin = arcade.Sprite(":resources:images/items/coinGold.png", COIN_SCALING)
# Position the coin
coin.center_x = random.randrange(SCREEN_WIDTH)
coin.center_y = random.randrange(SCREEN_HEIGHT)
coin_case_x = random.randrange(1,6)
coin_case_y = random.randrange(1,6)
coin.center_x = 230
coin.center_y = 100
# Add the coin to the lists
self.coin_list.append(coin)
"""
def on_draw(self):
"""
Render the screen.
@ -101,21 +107,28 @@ class MyGame(arcade.Window):
self.background)
# Draw all the sprites.
self.coin_list.draw()
#self.coin_list.draw()
self.player_list.draw()
# Render the text
arcade.draw_text(f"Score: {self.score}", 10, 20, arcade.color.WHITE, 14)
def on_mouse_motion(self, x, y, dx, dy):
"""
Called whenever the mouse moves.
"""
self.player_sprite.center_x = x
self.player_sprite.center_y = y
self.player_sprite.center_x = 66
self.player_sprite.center_y = 532
def on_update(self, delta_time):
""" Movement and game logic """
#mouv = input("mouv ? ")
#self.player_sprite.center_x = self.player_sprite.center_x + DISTANCE
"""
def on_mouse_motion(self, x, y, dx, dy):
Called whenever the mouse moves.
pass
"""
""" def on_update(self, delta_time):
Movement and game logic
# Call update on the coin sprites (The sprites don't do much in this
# example though.)
@ -127,7 +140,7 @@ class MyGame(arcade.Window):
# Loop through each colliding sprite, remove it, and add to the score.
for coin in hit_list:
coin.remove_from_sprite_lists()
self.score += 1
self.score += 1"""
def main():