Bare-Bones Pygame Platformer Starter (opens in new tab)
This Python pygame code is based on the JavaScript code and algorithms described in this article. import pygame W = 600 H = 300 S = 20 # pygame setup pygame.init() screen = pygame.display.set_mode((W, H)) clock = pygame.time.Clock() running = True # game setup player = pygame.Rect( (50, 50), (S, S) ) v = pygame.Vector2(0, 0) g = pygame.Vector2(0, 1) # platforms platforms = [ pygame.Rect((25, 100), (100, 50)), pygame.Rect((125, 125), (100, 50)) ] while running: # poll for events for event in p...
Read the original article