-
Notifications
You must be signed in to change notification settings - Fork 0
/
wizardLair.py
107 lines (85 loc) · 3.61 KB
/
wizardLair.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
"""
**************************************************
* *
* Katelyn Biesiadecki *
* CS454 Game Programming (Kang, Ijaz) *
* *
* Start Date: July 6, 2016 *
* Midway Due Date: July 13, 2016 *
* Final Due Date: July 23, 2016 *
* *
* Project Name: Hopper *
* Description: This class creates the wizard *
* lair for the challenge level of *
* the game. *
* *
**************************************************
"""
import random, sys, os, math
from math import sin, cos
from direct.actor.Actor import Actor
from direct.task import Task
from direct.showbase.DirectObject import DirectObject
from direct.showbase.ShowBase import ShowBase
from direct.showbase.InputStateGlobal import inputState
from direct.interval.IntervalGlobal import *
from panda3d.core import *
from panda3d.bullet import *
from direct.gui.OnscreenText import OnscreenText
class WizardLair(object):
def __init__(self, render, world, theLoader, hopper):
self.render = render
self.world = world
self.loader = theLoader
self.hopper = hopper
self.wizardGate = loader.loadModel("models/gate/gate.egg")
self.wizardGate.setPos(0, 0, 1) #Note: Wizard Gate (and other models) MUST be reparented to a platform for proper placement
self.wizardGate.setScale(0.007, 0.007, 0.004)
self.wizardGate.setH(90)
self.fire = loader.loadModel("models/fire/fire.egg")
self.fire.reparentTo(self.wizardGate)
self.fire.setPos(-600, -300, 0)
self.fire.setScale(3)
self.fire = loader.loadModel("models/fire/fire.egg")
self.fire.reparentTo(self.wizardGate)
self.fire.setPos(600, -300, 0)
self.fire.setScale(3)
self.castle = loader.loadModel("models/art/alice-amusement-park--hauntedhouse/hauntedhouse.egg")
self.castle.setPos(0, 0, 0)
self.castle.setScale(0.15, 0.15, 0.3)
self.castle.setH(180)
castleShape = BulletBoxShape(Vec3(9, 6, 7))
self.castleBulletNode = BulletRigidBodyNode("WizardCastle")
self.castleBulletNode.addShape(castleShape)
self.castleNP = self.render.attachNewNode(self.castleBulletNode)
self.castleNP.setPos(-38, 33, 13)
self.world.attachRigidBody(self.castleBulletNode)
lairShape = BulletBoxShape(Vec3(4, 8.5, 7))
self.lairBulletNode = BulletRigidBodyNode("WizardLair")
self.lairBulletNode.addShape(lairShape)
self.lairNP = self.render.attachNewNode(self.lairBulletNode)
self.lairNP.setPos(-110, 15, 20)
self.world.attachRigidBody(self.lairBulletNode)
self.lair = loader.loadModel("models/Church/Church.egg")
self.lair.setPos(0, 0, 1) #Note: Wizard Lair (and other models) MUST be reparented to a platform for proper placement
self.lair.setScale(0.3, 0.3, 0.2)
self.lair.setH(90)
"""
wizardLairShape = BulletPlaneShape(Vec3(0, 0, 1), 0)
wizardLairBulletNode = BulletRigidBodyNode("WizardFloor")
wizardLairBulletNode.addShape(wizardLairShape)
wizardLairNP = self.render.attachNewNode(wizardLairBulletNode)
wizardLairNP.setPos(0, 0, -10)
self.world.attachRigidBody(wizardLairBulletNode)
"""
#fix
"""
self.environ = loader.loadModel("models/square")
self.environ.reparentTo(render)
self.environ.setPos(0,0,-10)
self.environ.setScale(100,100,1)
self.floorTex = self.loader.loadTexture('models/wizardLair.jpg')
self.environ.setTexture(self.floorTex, 1)
self.floorTex.setWrapU(Texture.WMRepeat)
"""
base.setBackgroundColor(0, 0, 0)