-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprojectile.py
30 lines (22 loc) · 949 Bytes
/
projectile.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
#Esteban Rojas and Danny McCormack
#CSE 30332 Final Project
import pygame
import Utilities
class Projectile(pygame.sprite.Sprite):
def __init__(self, gs = None, initX = 0, initY = 0, hspeed = 10, vspeed = 0, angle = 0):
pygame.sprite.Sprite.__init__(self)
self.gs = gs
self.image = pygame.image.load("res/projectile.png").convert()
self.rect = self.image.get_rect()
self.hspeed = hspeed
self.vspeed = vspeed
#Tilt the image
self.image = Utilities.rot_center(self.image, angle)
#Make it start at the local player's position
self.rect.centerx = initX
self.rect.centery = initY
#keep original image to limit resize errors
self.orig_image = self.image
def tick(self):
#Update the position of the projectile on the screen
self.rect = self.rect.move(self.hspeed, self.vspeed)