Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pygame
- SCREEN_WIDTH = 1024
- SCREEN_HEIGHT = 800
- class Pad(pygame.sprite.Sprite):
- def __init__(self):
- super(Pad, self).__init__()
- self.surf = pygame.image.load("images/pad.png")
- self.moving = 0
- self.resetPosition()
- #resetowanie pozycji
- def resetPosition(self):
- self.rect = pygame.Rect(SCREEN_WIDTH/2-70, SCREEN_HEIGHT-100, 140, 30)
- #poruszanie
- def move(self, value):
- speed = 10
- self.rect.move_ip(value*speed, 0)
- self.moving = value
- if self.rect.left <= 0: self.rect.x = 0
- if self.rect.right >= SCREEN_WIDTH: self.rect.x = SCREEN_WIDTH-140
- #aktualizacja
- def update(self):
- self.moving = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement