forked from AzyCrw4282/CS1830-papaya
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Wall.py
28 lines (24 loc) · 760 Bytes
/
Wall.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
try:
import simplegui
except ImportError:
import SimpleGUICS2Pygame.simpleguics2pygame as simplegui
import random
import math
from Vector import Vector
class Wall:
def __init__(self, x, border, color):
self.x = x
self.border = border
self.color = color
self.normal = Vector((1,0))
self.edgeR = x + 1 + self.border
self.edgeL = x - 1 - self.border
def draw(self, canvas):
canvas.draw_line((self.x, 0),
(self.x, 900),
self.border*2+1,
self.color)
def hit(self, ball):
hR = (ball.offsetL() <= self.edgeR)
hL = (ball.offsetR() >= self.edgeL)
return hR and hL