1
Fork 0

updated movement

This commit is contained in:
Jake Howard 2015-04-29 09:48:37 +01:00
parent 392f97be4f
commit 6dad1819dd

View file

@ -2,14 +2,19 @@ import pygame
class Shooter(pygame.sprite.Sprite):
def __init__(self, color=(30,0,150), width=64, height=64):
def __init__(self, window, color=(30,0,150), width=50, height=25):
super().__init__()
self.width = width
self.height = height
self.image = pygame.Surface((width, height))
self.image.fill(color)
self.rect = self.image.get_rect()
self.speed = 4
self.window_rect = window.get_rect()
def set_position(self,x,y):
self.rect.x, self.rect.y = x,y
def move(self, value): self.rect.x += value
def move(self, value):
self.rect.x += value
self.rect.clamp_ip(self.window_rect)