-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRacecar.py
53 lines (40 loc) · 1.82 KB
/
Racecar.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'''
===============================================================================
ENGR 133 Fa 2020
Assignment Information
Assignment: Final Project
Author: Alec Pannunzio, afpannun@purdue.edu
Team ID: LC4-5
===============================================================================
'''
from math import sqrt,cos,sin,pi
from game_engine.RelativeSprite import RelativeSprite
import pygame
# it's a racecar! (Vroom vroom) - basically just sets up the RelativeSprites to be used as a racecar
# note: must call setRaceTrack() for track awareness to work
'''
class members:
raceCarImg - pygame.Surface - the image of a racecar to be used for the sprite
racetrack - Racetrack - the racetrack we will be driving on ; for figuring out if we are on the track and CPU driving
racetrackSet - boolean - whether we have set a racetrack yet
'''
class Racecar(RelativeSprite):
def __init__(self,objectDraw,isFirstPerson,scale,racecar_source):
screenXSize = objectDraw.screenSizeX;
screenYSize = objectDraw.screenSizeY;
super(Racecar,self).__init__("racecar", screenXSize/2,screenYSize/2,scale,racecar_source,objectDraw);
self.racetrack = None;
self.racetrackSet = False;
# sets the racetrack and allows track awareness to work
def setRacetrack(self, racetrack):
self.racetrack = racetrack;
self.racetrackSet = True;
'''
===============================================================================
ACADEMIC INTEGRITY STATEMENT
I have not used source code obtained from any other unauthorized
source, either modified or unmodified. Neither have I provided
access to my code to another. The project I am submitting
is my own original work.
===============================================================================
'''