From: Skullheadx <94652084+Skullheadx@users.noreply.github.com> Date: Wed, 5 Jul 2023 02:06:36 +0000 (-0400) Subject: web stuff X-Git-Url: http://git.skullheadx.com/nixos/static/gitweb.css?a=commitdiff_plain;h=a475b8a4fc881a0d68400fe18400f01853cbf324;p=fruit-ninja.git web stuff --- diff --git a/Fruit Ninja.exe b/Fruit Ninja.exe deleted file mode 100644 index 214d847..0000000 Binary files a/Fruit Ninja.exe and /dev/null differ diff --git a/assets/logo.ico b/assets/logo.ico deleted file mode 100644 index 7fbbb81..0000000 Binary files a/assets/logo.ico and /dev/null differ diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000..850a6b9 Binary files /dev/null and b/assets/logo.png differ diff --git a/assets/sounds/Swishes/long-medium-swish-44324.ogg b/assets/sounds/Swishes/long-medium-swish-44324.ogg new file mode 100644 index 0000000..0373924 Binary files /dev/null and b/assets/sounds/Swishes/long-medium-swish-44324.ogg differ diff --git a/assets/sounds/Swishes/long-medium-swish-44324.wav b/assets/sounds/Swishes/long-medium-swish-44324.wav deleted file mode 100644 index 140ddf2..0000000 Binary files a/assets/sounds/Swishes/long-medium-swish-44324.wav and /dev/null differ diff --git a/assets/sounds/Swishes/swing-6045.ogg b/assets/sounds/Swishes/swing-6045.ogg new file mode 100644 index 0000000..4d91740 Binary files /dev/null and b/assets/sounds/Swishes/swing-6045.ogg differ diff --git a/assets/sounds/Swishes/swing-6045.wav b/assets/sounds/Swishes/swing-6045.wav deleted file mode 100644 index 192c421..0000000 Binary files a/assets/sounds/Swishes/swing-6045.wav and /dev/null differ diff --git a/assets/sounds/Swishes/swish-sound-94707.ogg b/assets/sounds/Swishes/swish-sound-94707.ogg new file mode 100644 index 0000000..54b9f2b Binary files /dev/null and b/assets/sounds/Swishes/swish-sound-94707.ogg differ diff --git a/assets/sounds/Swishes/swish-sound-94707.wav b/assets/sounds/Swishes/swish-sound-94707.wav deleted file mode 100644 index 1bedb42..0000000 Binary files a/assets/sounds/Swishes/swish-sound-94707.wav and /dev/null differ diff --git a/assets/sounds/hq-explosion-6288.ogg b/assets/sounds/hq-explosion-6288.ogg new file mode 100644 index 0000000..db0d56e Binary files /dev/null and b/assets/sounds/hq-explosion-6288.ogg differ diff --git a/assets/sounds/hq-explosion-6288.wav b/assets/sounds/hq-explosion-6288.wav deleted file mode 100644 index 1ef2cdd..0000000 Binary files a/assets/sounds/hq-explosion-6288.wav and /dev/null differ diff --git a/assets/sounds/medium-explosion-40472.ogg b/assets/sounds/medium-explosion-40472.ogg new file mode 100644 index 0000000..67539ec Binary files /dev/null and b/assets/sounds/medium-explosion-40472.ogg differ diff --git a/assets/sounds/medium-explosion-40472.wav b/assets/sounds/medium-explosion-40472.wav deleted file mode 100644 index f0621b4..0000000 Binary files a/assets/sounds/medium-explosion-40472.wav and /dev/null differ diff --git a/assets/sounds/sub-bass-4-secondsssss-6241.ogg b/assets/sounds/sub-bass-4-secondsssss-6241.ogg new file mode 100644 index 0000000..1f6e204 Binary files /dev/null and b/assets/sounds/sub-bass-4-secondsssss-6241.ogg differ diff --git a/assets/sounds/sub-bass-4-secondsssss-6241.wav b/assets/sounds/sub-bass-4-secondsssss-6241.wav deleted file mode 100644 index 80da76d..0000000 Binary files a/assets/sounds/sub-bass-4-secondsssss-6241.wav and /dev/null differ diff --git a/bomb.py b/bomb.py index 133934e..2ecc41d 100644 --- a/bomb.py +++ b/bomb.py @@ -43,8 +43,8 @@ class Bomb(Fruit): EXPLOSION_TIME = 500 explosion_sound_effects = [ - pygame.mixer.Sound("assets/sounds/hq-explosion-6288.wav"), - pygame.mixer.Sound("assets/sounds/medium-explosion-40472.wav"), + pygame.mixer.Sound("assets/sounds/hq-explosion-6288.ogg"), + pygame.mixer.Sound("assets/sounds/medium-explosion-40472.ogg"), ] def __init__(self): diff --git a/game.py b/game.py index b07d96c..23d8d5e 100644 --- a/game.py +++ b/game.py @@ -29,11 +29,11 @@ class Game: BACKGROUND.blit(background_tile, (x * WIDTH / tile_cols, y * HEIGHT / tile_rows)) BACKGROUND = Texture.from_surface(renderer, BACKGROUND) - bass_sound_effect = pygame.mixer.Sound("assets/sounds/sub-bass-4-secondsssss-6241.wav") + bass_sound_effect = pygame.mixer.Sound("assets/sounds/sub-bass-4-secondsssss-6241.ogg") bass_sound_effect.set_volume(0.1) - slash_sounds = [pygame.mixer.Sound(f"assets/sounds/Swishes/long-medium-swish-44324.wav"), - pygame.mixer.Sound(f"assets/sounds/Swishes/swing-6045.wav"), - pygame.mixer.Sound(f"assets/sounds/Swishes/swish-sound-94707.wav"), + slash_sounds = [pygame.mixer.Sound(f"assets/sounds/Swishes/long-medium-swish-44324.ogg"), + pygame.mixer.Sound(f"assets/sounds/Swishes/swing-6045.ogg"), + pygame.mixer.Sound(f"assets/sounds/Swishes/swish-sound-94707.ogg"), ] HIGH_SCORE_FILE = "high_score.txt" diff --git a/high_score.txt b/high_score.txt index c227083..9573848 100644 --- a/high_score.txt +++ b/high_score.txt @@ -1 +1 @@ -0 \ No newline at end of file +326 \ No newline at end of file diff --git a/main.py b/main.py index 2053bfe..8045b77 100644 --- a/main.py +++ b/main.py @@ -1,31 +1,41 @@ +import asyncio +import pygame +from pygame._sdl2 import Window, Renderer, Texture, Image +import random +import os +import math +from setup import * from game import Game from menu import Menu -from setup import * -FPS = 60 -clock = pygame.time.Clock() -scene = Menu() +async def main(): + FPS = 60 + clock = pygame.time.Clock() + + scene = Menu() + is_running = True + while is_running: + delta = clock.tick(FPS) + renderer.clear() -is_running = True -while is_running: - delta = clock.tick(FPS) - renderer.clear() + status = scene.update(delta) + scene.draw() - status = scene.update(delta) - scene.draw() + # fps_text = font_small.render(f"FPS: {clock.get_fps():.0f}", True, DARK_GRAY) + # fps_txt = Texture.from_surface(renderer, fps_text) + # fps_txt.draw(None, pygame.Vector2(10, 75)) - # fps_text = font_small.render(f"FPS: {clock.get_fps():.0f}", True, DARK_GRAY) - # fps_txt = Texture.from_surface(renderer, fps_text) - # fps_txt.draw(None, pygame.Vector2(10, 75)) + renderer.present() + await asyncio.sleep(0) - renderer.present() + if status == COMMAND_EXIT: + is_running = False + elif status == COMMAND_START: + scene = Game() + elif status == COMMAND_MENU: + scene = Menu() - if status == COMMAND_EXIT: - is_running = False - elif status == COMMAND_START: - scene = Game() - elif status == COMMAND_MENU: - scene = Menu() + pygame.quit() -pygame.quit() +asyncio.run(main()) diff --git a/menu.py b/menu.py index 21ac97b..c705dba 100644 --- a/menu.py +++ b/menu.py @@ -19,9 +19,9 @@ class Menu: # Slash sound effects slash_sounds = [ - pygame.mixer.Sound(f"assets/sounds/Swishes/long-medium-swish-44324.wav"), - pygame.mixer.Sound(f"assets/sounds/Swishes/swing-6045.wav"), - pygame.mixer.Sound(f"assets/sounds/Swishes/swish-sound-94707.wav"), + pygame.mixer.Sound(f"assets/sounds/Swishes/long-medium-swish-44324.ogg"), + pygame.mixer.Sound(f"assets/sounds/Swishes/swing-6045.ogg"), + pygame.mixer.Sound(f"assets/sounds/Swishes/swish-sound-94707.ogg"), ] def __init__(self): diff --git a/setup.py b/setup.py index 0c2aced..2089d93 100644 --- a/setup.py +++ b/setup.py @@ -1,13 +1,13 @@ +import asyncio import pygame from pygame._sdl2 import Window, Renderer, Texture, Image import random import os import math -from functools import cache pygame.init() WIDTH, HEIGHT = pygame.display.Info().current_w, pygame.display.Info().current_h -display = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN) +display = pygame.display.set_mode((WIDTH, HEIGHT)) window = Window.from_display_module() renderer = Renderer(window) pygame.mouse.set_visible(False) @@ -15,7 +15,7 @@ pygame.mouse.set_visible(False) SCALE = pygame.Vector2(WIDTH / 1536, HEIGHT / 864) pygame.display.set_caption("Fruit Shinobi") -icon = pygame.image.load("assets/logo.ico").convert() +icon = pygame.image.load("assets/logo.png").convert() pygame.display.set_icon(icon) # fonts