python - Pygame refuses to draw objects -


so i'm working on kind of platformer game. code you'll see beginnings of it. problem reason pygame refuses draw objects onto screen. seems alright, , don't errors. appreciated. :)

import pygame pygame.locals import * pygame.init() red = (255,0,0) green = (0,255,0) blue = (0,0,255) black = (0,0,0) white = (255,255,255) width = 1280 height = 720 score = 0 'create window' screen = pygame.display.set_mode((width,height)) clock = pygame.time.clock() 'sprite groups' all_sprites = pygame.sprite.group() blocks = pygame.sprite.group() class player(pygame.sprite.sprite):     def __init__(self):         pygame.sprite.sprite.__init__(self)         self.image = pygame.surface((32,32))         self.image.fill(green)         self.rect = self.image.get_rect()         self.rect.x = 640         self.rect.y = 360         self.speed = 0     def update(self):         pass class block(pygame.sprite.sprite):     def __init__(self):         pygame.sprite.sprite.__init__(self)         self.image = pygame.surface((32,32))         self.image.fill(blue)         self.rect = self.image.get_rect()         self.rect.x = 640         self.rect.y = 395   p = player() all_sprites.add(p) running = true while running:     all_sprites.draw(screen) 

inside of loop need include screen.update() each frame screen refreshes:

while running:     all_sprites.draw(screen)     screen.update() 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -