-
Notifications
You must be signed in to change notification settings - Fork 0
/
Goal.py
30 lines (27 loc) · 970 Bytes
/
Goal.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
30
#################################################
# Goal.py
# Goal class used in minigame
#
# Your name: Jackie Yang Section: J
# Your andrew id: jaclyny
#
#################################################
from Drawnimate import *
import random
class Goal(object):
def __init__(self, app):
self.app = app
self.margin = 170
self.locX = self.makeLocX()
self.locY = self.app.height - self.margin
# determines random x location of the goal
def makeLocX(self):
num = 3
randNum = random.randint(0,2)
# randomly chooses if goal will be to the left or right of player
if randNum == 0:
return random.randint(self.app.width / 2 - self.app.width * num,
self.app.width / 2 - self.margin * 2)
else:
return random.randint(self.app.width / 2 + self.margin * 2,
self.app.width / 2 + self.app.width * num)