-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobjects.py
30 lines (21 loc) · 865 Bytes
/
objects.py
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
# -*- coding: utf-8 -*-
import pygame
from rigidBodies import *
class Bola(RoundBody):
def __init__(self, color, pos=None, radio=15):
RoundBody.__init__(self, pos, radio, affected_by_gravity=False)
self.color = color
def draw(self, screen):
pygame.draw.circle(screen, self.color, self.pos.int(), self.radio)
class Rect(RectBody):
def __init__(self, color, rect):
RectBody.__init__(self, rect)
self.color = color
def draw(self, screen):
pygame.draw.polygon(screen,
self.color,
[[p.x + self._pos.x, p.y + self._pos.y] for p in self.points], 0
)
# TODO check witch is faster
# for line in self.lines:
# pygame.draw.line(screen, (20, 0, 0), line[0].get_comps(), line[1].get_comps(),)