mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-23 11:42:39 -06:00
26 lines
878 B
Python
Executable file
26 lines
878 B
Python
Executable file
from DistributedTreasure import DistributedTreasure
|
|
import math, random
|
|
|
|
class DistributedEFlyingTreasure(DistributedTreasure):
|
|
|
|
def __init__(self, cr):
|
|
DistributedTreasure.__init__(self, cr)
|
|
self.scale = 2
|
|
self.delT = math.pi * 2.0 * random.random()
|
|
self.shadow = 0
|
|
|
|
def disable(self):
|
|
DistributedTreasure.disable(self)
|
|
taskMgr.remove(self.taskName('flying-treasure'))
|
|
|
|
def setPosition(self, x, y, z):
|
|
DistributedTreasure.setPosition(self, x, y, z)
|
|
self.initPos = self.nodePath.getPos()
|
|
taskMgr.add(self.animateTask, self.taskName('flying-treasure'))
|
|
|
|
def animateTask(self, task):
|
|
pos = self.initPos
|
|
t = 0.5 * math.pi * globalClock.getFrameTime()
|
|
dZ = 5.0 * math.sin(t + self.delT)
|
|
self.nodePath.setPos(pos[0], pos[1], pos[2] + dZ)
|
|
return task.cont
|