This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
class GameMap: | |
def __init__(self, path, tile_map_def): | |
self.map_surf = pygame.image.load(path) | |
self.tile_map_def = tile_map_def | |
self.map_data = self.load_map_image_from_surface() | |
self.width = self.map_surf.get_width() | |
self.height = self.map_surf.get_height() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
import math | |
from pygame import Vector2 | |
pygame.init() | |
def intersect_line(P0, P1, Q0, Q1): | |
d = (P1[0]-P0[0]) * (Q1[1]-Q0[1]) + (P1[1]-P0[1]) * (Q0[0]-Q1[0]) | |
if d == 0: | |
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
from pygame import Vector2 | |
from pygame import Vector3 | |
from typing import Tuple | |
class Bar: | |
def __init__(self, | |
pos: Tuple[int, int], | |
size: Tuple[int, int], | |
color: Tuple[int, int, int], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
from pygame import Vector2 | |
pygame.init() | |
class Game: | |
def __init__(self): | |
self.window_size = Vector2(512) | |
self.window = pygame.display.set_mode(self.window_size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
from pygame import Vector2 | |
pygame.init() | |
class Game: | |
def __init__(self): | |
self.window_size = Vector2(512) | |
self.window = pygame.display.set_mode( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import pygame | |
import random | |
from pygame import Vector2 | |
pygame.init() | |
class Game: | |
def __init__(self): | |
self.window_size = Vector2(512) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import math | |
import pygame | |
import random | |
from pygame import Vector2 | |
pygame.init() | |
class Game: | |
def __init__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import pygame | |
from pygame import Vector2 | |
class ParticleEmitter: | |
__slots__ = [ | |
'pos', 'vel', 'speed', | |
'particles', 'age', 'spawn_rate', | |
'last_spawn', 'shape', 'particle_class', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
from pygame import Vector2 | |
pygame.init() | |
class Game: | |
def __init__(self): | |
self.window_size = Vector2(512) | |
self.window = pygame.display.set_mode(self.window_size) | |
pygame.display.set_caption('playground') |
OlderNewer