def genbullets(Task):
playmusketsound()
b=bullet()
b.bullet.setX(self.farmer.getX()) #Set initial position
b.bullet.setZ(self.farmer.getZ())#zpos = zm.card_gravestone_1.getZ() #get z axis height position
bulletArray.append(b)
self.farmer.find('**/+SequenceNode').node().play(0, 5)
print 'newbullet'
bullettimer()
def bullettimer():
taskMgr.doMethodLater(random.randint(1,5), genbullets, 'MyTaskName', extraArgs=[], appendTask=True)
taskMgr.doMethodLater(random.randint(1,5), genbullets, 'MyTaskName', extraArgs=[], appendTask=True)
def updatebullet(Task):
pos=0
i=0
ii=0
for z in bulletArray:
for i in range(len(bulletArray)-1,-1,-1):
if not bulletArray[i].bullet.isEmpty():
pos=bulletArray[i].bullet.getX()
posZ=bulletArray[i].bullet.getZ()
bulletArray[i].bullet.setX(bulletArray[i].bullet.getX()-.0008)
print bulletArray[i].bullet.getX()
for x in zombieArray:
for ii in range(len(zombieArray)-1,-1,-1):
if not zombieArray[ii].basezombie.isEmpty():
zposZ=zombieArray[ii].basezombie.getZ()
if posZ-zposZ < 0.05:
zpos=zombieArray[ii].basezombie.getX()
collpos=pos - zpos
if collpos <= 0:
bulletArray[i].bullet.removeNode()
if bulletArray[i].bullet.getX() <= -0.75:
bulletArray[i].bullet.removeNode()
return Task.cont
taskMgr.add(updatebullet, 'bullettask')
I had this problem before but it was caused indentation error- this time though I can’t get what I am doing wrong- I even printed out the getX to see if it moved the same. And they do.
Why when a new bullet creates does it speed up all the bullets? The objects move at the same step distance and at the same number of steps-
941 steps at -.0008 per step- the last object took 1.9528689000000 seconds to cover the distance, but the previos object took 2.22112000000 seconds to complete- so that means that by the time the last instance had finished there was an over decrease in time by 0.2682511 seconds from the previous instance.
So if the steps stay the same, the rate stays the same, but the time elapsed changes does that mean I am somehow altering the framerate- speeding it up?
I am really confused
JB SKaggs