forked from i-k/SpaceGrabem
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Base.py
61 lines (50 loc) · 1.67 KB
/
Base.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
from pandac.PandaModules import (
# AmbientLight,
# DirectionalLight,
# PointLight,
NodePath,
Vec3,
# Vec4,
# Point3,
# Quat,
OdeUtil,
# OdeWorld,
# OdeHashSpace,
# OdeJointGroup,
# OdeMass,
# OdeBody,
# OdeSphereGeom,
OdeBoxGeom,
BitMask32,
# TextNode
)
from StaticObject import StaticObject
#from CollectibleTypes import Restore
class Base(StaticObject):
def __init__(self, game):
self.game = game
self.collGeomInner = OdeBoxGeom( self.game.physicsSpace, 24,8,2)
#self.collGeom.setBody(self.body)
self.collGeomInner.setCategoryBits( BitMask32(1) )
self.collGeomInner.setCollideBits( BitMask32(1) )
self.collGeomOuter = OdeBoxGeom( self.game.physicsSpace, 28,6,2)
#self.collGeom.setBody(self.body)
self.collGeomOuter.setCategoryBits( BitMask32(1) )
self.collGeomOuter.setCollideBits( BitMask32(1) )
self.visualNode = NodePath('Visual node')
self.visualNode.reparentTo(render)
model = loader.loadModel('Base.egg')
model.reparentTo(self.visualNode)
def checkCollision(self, ship):
if OdeUtil.collide(ship.collGeom, self.collGeomInner) and ship.hasBall():
#if ship.hasBall():
ship.addPoints(ship.Ball.getValue())
ship.dropBall( z = 300 )
print ship.SHIP_TYPE + " " + str(ship.getPoints()) + " Points! "
#print " Base One! "
def addToBaseList(self, baseList):
baseList.append(self)
def setPos(self, pos):
self.visualNode.setPos( pos )
self.collGeomInner.setPosition( pos )
self.collGeomOuter.setPosition( pos )