-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtile.py
More file actions
31 lines (25 loc) · 737 Bytes
/
tile.py
File metadata and controls
31 lines (25 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pygame
from pygame.locals import *
class Tile(object):
def __init__(self, passable, surface):
super(Tile, self).__init__()
self.passable = passable
self.x = 0
self.y = 0
self.position = (self.x, self.y)
self.surface = surface
self.rect = self.surface.get_rect()
def setPosition(posX, posY):
self.x = posX
self.y = posY
def getSurface(self):
return self.surface
def getRect(self):
return self.rect
def setPositionAndGet(self, posX, posY):
self.x = posX
self.y = posY
self.rect = pygame.Rect(posX, posY, self.surface.get_rect().width, self.surface.get_rect().height)
return self.rect
def draw(self, screen, position):
screen.blit(self.getSurface(), position)