What do you want to save?
Add Code snippet
New code examples
-
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 -
Other 2021-10-19 09:27:07
how to change color of square in pygame with keypress
#Import statements are to enable the code to use the functions from the library import pygame import sys import os import random #instructions to windows to center the game window in the center of #the screen, which it might ignore os.environ["SDL_V... Add solution -
Python 2021-10-17 19:06:06
pygame template
import pygame,sys #game initialization pygame.init() window = pygame.display.set_mode((900,600),0,32) pygame.display.set_caption('Basic Pygame Template') clock = pygame.time.Clock() #game loop while True: for event in pygame.event.get(): if ... Add solution -
Python 2021-10-15 08:34:06
python pygame
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