What do you want to save?
Add Code snippet
New code examples
-
Shell/Bash 2021-09-15 13:00:04
how to install pygame
# To install pygame, type 'pip install pygame' in the # windows powershell or the os terminal # To create a blank screen as a setup for a game, use: import pygame import sys pygame.init() clock = pygame.time.Clock() FPS = 30 # How many times the scre... Add solution -
Python 2021-09-13 21:53:02
how to make pygame use float number
'''Pygame cannot adjust the image/rectangle position with floats, because it rounds the float to an integer. But with this method it works''' import pygame pygame.__init__() WIDTH = 300 HEIGHT = 300 screen = pygame.display.set_mode((WIDTH, HEIGHT)) #Cr... Add solution -
Python 2021-09-13 16:30:05
python snake game code
#this code has asumed that you have intsalled pygame,time,random> import pygame import time import random pygame.init() white = (255, 255, 255) yellow = (255, 255, 102) black = (0, 0, 0) red = (213, 50, 80) green = (0, 255, 0) blue = (50, 153, 213)... Add solution -
Python 2021-09-12 11:04:01
fdriving gam in python
import pygame import time import random pygame.init() display_width = 800 display_height = 600 black = (0,0,0) white = (255,255,255) red = (255,0,0) car_width = 73 gameDisplay = pygame.display.set_mode((display_width,display_height)) pygame.display.s... Add solution -
Python 2021-09-06 23:16:02
pygame examples
1 # Simple pygame program 2 3 # Import and initialize the pygame library 4 import pygame 5 pygame.init() 6 7 # Set up the drawing window 8 screen = pygame.display.set_mode([500, 500]) 9 10 # Run until the user asks to quit 11 running = True 12... Add solution -
Python 2021-09-03 09:41:03
2d grid python pygame
import pygame BLACK = (0, 0, 0) WHITE = (200, 200, 200) WINDOW_HEIGHT = 400 WINDOW_WIDTH = 400 pygame.init() SCREEN = pygame.display.set_mode((WINDOW_HEIGHT, WINDOW_WIDTH)) CLOCK = pygame.time.Clock() SCREEN.fill(BLACK) def draw_grid(): block_siz... Add solution -
Python 2021-08-31 00:40:01
pygame tutorial
# To install pygame, type 'pip install pygame' in the # windows powershell or the os terminal # To create a blank screen as a setup for a game, use: import pygame import sys pygame.init() clock = pygame.time.Clock() FPS = 30 # How many times the scre... Add solution -
Other 2021-08-27 21:57:02
pixelart pygame
# Simple pygame project for pixelart import pygame screen = pygame.display.set_mode((1280, 720)) pixelart_surface = pygame.Surface((512, 288)) running = True while running: pixelart_surface.fill((0, 0, 0)) for event in pygame.event.get(): if eve... Add solution