-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWall.py
More file actions
35 lines (27 loc) · 1011 Bytes
/
Wall.py
File metadata and controls
35 lines (27 loc) · 1011 Bytes
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
#1/usr/bin/python2
########################################################################
# File Name: Wall.py
# Authors: Nicole Lewey and Jacob Lundgren
# Date: 12/08/2014
# Class: CS360 - Open Source
# Assignment: Ninja Game - Create Open Source Project
# Purpose: Class for Wall sprite object
########################################################################
import pygame
VERTICAL = 90
class Wall(pygame.sprite.Sprite):
def __init__(self, x = 0, y = 0, vertical = False):
"""Constructor for the wall object.
Sets location to the passed in coordinates.
If vertical is True, rotate the wall 90 degrees
"""
pygame.sprite.Sprite.__init__(self)
try:
self.image = pygame.image.load ('images/NinjaGame_Wall.png')
except pygame.error, message:
print 'Cannot load image: NinjaGame_Wall.png'
raise SystemExit, message
self.image.convert()
if vertical:
self.image = pygame.transform.rotate(self.image, VERTICAL)
self.rect = self.image.get_rect().move (x, y)