What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-20 21:42:21
pygame for loop for draw shape
import pygame from pygame.locals import * from sys import exit from random import * pygame.init() screen = pygame.display.set_mode((640, 480), 0,32) class Rectangle: def __init__(self, pos, color, size): self.pos = pos self.color =... Add solution -
Python 2021-11-20 19:26:20
python libraries for game development
import pygame pygame.init() win = pygame.display.set_mode((500,500)) pygame.display.set_caption("First Game") x = 50 y = 50 width = 40 height = 60 vel = 5 run = True while run: pygame.time.delay(100) # This will delay the game the given ... Add solution -
Python 2021-11-15 07:22:18
4 in a rpw pygame code
import pygame import sys import time from pygame.locals import * import numpy as np COLUMNS = 7 ROWS = 6 WINAMOUNT = 4 WINDOWWIDTH = 800 WINDOWHEIGHT = 600 COUNTERDIAMETER = 50 PLAYWIDTH = COLUMNS*(COUNTERDIAMETER+25)+25 PLAYHEIGHT = ROWS*(COUNTERDIAMETE... Add solution -
Python 2021-11-03 06:44:15
how to create a window in pygame
import pygame pygame.init() back = (192,192,192) gameDisplay = pygame.display.set_mode((800,600)) pygame.display.set_caption('A bit Racey') gameDisplay.fill(back) clock = pygame.time.Clock() running = True while running: for event in pygame.event.get(... Add solution -
Python 2021-11-01 18:54:15
pygame rect follower
import pygame import random import math # --- constants --- (UPPER_CASE_NAMES) SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 FPS = 25 # for more than 220 it has no time to update screen BLACK = (0, 0, 0) WHITE = (255, 255, 255) # --- classes --- (CamelCaseN... Add solution -
Python 2021-10-29 16:11:19
how to setup 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-10-25 05:13:14
what is pygame userevent
import pygame from pygame import display, font, time, mouse, draw from pygame.math import Vector2 import random import sys class Snake: def __init__(self): self.body = [Vector2(5, 10), Vector2(6, 10), Vector2(7, 10)] self.direction = ... Add solution -
Python 2021-10-22 01:02:08
pygame snake
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) dis_width = 600 dis_height = 400 dis = pygam... Add solution -
Python 2021-10-21 18:37:09
snake python
import pygame import numpy import random import math pygame.init() clock = pygame.time.Clock() screen = pygame.display.set_mode((377, 377)) grid = numpy.zeros((15, 15), dtype="int8") for i in range(4): grid[7][2+i] = 2 apple_pos = [7, 11] gr... Add solution