What do you want to save?
Add Code snippet
New code examples
-
Python 2022-01-25 11:25:22
timer pythongame
import pygame pygame.init() screen = pygame.display.set_mode((128, 128)) clock = pygame.time.Clock() counter, text = 10, '10'.rjust(3) pygame.time.set_timer(pygame.USEREVENT, 1000) font = pygame.font.SysFont('Consolas', 30) while True: for e in pyga... Add solution -
Python 2021-11-21 18:20:13
how to make a backround color in pygame
#getting pygame and another library we need for setup import pygame, sys #setup(for starting the pygame i'm pretty sure) pygame.init() #making the screen width = 1280 height = 960 screen=pygame.display.set_mode((width,height)) #this is the color I want... Add solution -
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