Skip to content

Instantly share code, notes, and snippets.

View bilhox's full-sized avatar
💭
The tea-room has some work to do !

Lody bilhox

💭
The tea-room has some work to do !
  • Polytech Nice Sophia
  • Nice / Toulouse - France
  • 12:06 (UTC +02:00)
View GitHub Profile
@bilhox
bilhox / scroll_repeat.py
Created June 22, 2024 14:41
Consider using an image that fits the window size perfectly.
import pygame
pygame.init()
window_size = pygame.Vector2(1920, 1080) * 2/3
screen = pygame.display.set_mode(window_size)
surf = pygame.image.load("image_path").convert_alpha()
surf = pygame.transform.scale_by(surf, 2/3)
@bilhox
bilhox / world.py
Created February 26, 2024 14:54
Récupère le texte du fichier passé en argument lors de l'exécution, et crée un fichier avec tout les mots utilisés sans doublon.
import sys
text = ""
ponctuation = ['?', '...', '..', '.', ':', '"', "'", '!', ';', ',', '/', '&']
with open(sys.argv[1], mode='r', newline='') as reader:
for line in reader.readlines():
for c in line.strip():
if c not in ponctuation:
text += c
import sys
import pygame
def collide(rects : list[pygame.Rect] , rect : pygame.Rect) -> list[pygame.Rect]:
"""
Cette fonction sert à lister les rectangles qui touche la hitbox du joueur
"""
collided = []