mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-29 08:15:18 -04:00
samples: Update globalClock
references to base.clock
This commit is contained in:
parent
eefcae7b05
commit
f3c481578e
@ -202,7 +202,7 @@ class AsteroidsDemo(ShowBase):
|
|||||||
def gameLoop(self, task):
|
def gameLoop(self, task):
|
||||||
# Get the time elapsed since the next frame. We need this for our
|
# Get the time elapsed since the next frame. We need this for our
|
||||||
# distance and velocity calculations.
|
# distance and velocity calculations.
|
||||||
dt = globalClock.getDt()
|
dt = self.clock.dt
|
||||||
|
|
||||||
# If the ship is not alive, do nothing. Tasks return Task.cont to
|
# If the ship is not alive, do nothing. Tasks return Task.cont to
|
||||||
# signify that the task should continue running. If Task.done were
|
# signify that the task should continue running. If Task.done were
|
||||||
|
@ -266,7 +266,7 @@ class BallInMazeDemo(ShowBase):
|
|||||||
def rollTask(self, task):
|
def rollTask(self, task):
|
||||||
# Standard technique for finding the amount of time since the last
|
# Standard technique for finding the amount of time since the last
|
||||||
# frame
|
# frame
|
||||||
dt = globalClock.getDt()
|
dt = base.clock.dt
|
||||||
|
|
||||||
# If dt is large, then there has been a # hiccup that could cause the ball
|
# If dt is large, then there has been a # hiccup that could cause the ball
|
||||||
# to leave the field if this functions runs, so ignore the frame
|
# to leave the field if this functions runs, so ignore the frame
|
||||||
|
@ -123,7 +123,7 @@ class Game(ShowBase):
|
|||||||
|
|
||||||
def update(self, task):
|
def update(self, task):
|
||||||
"""Updates the camera based on the keyboard input."""
|
"""Updates the camera based on the keyboard input."""
|
||||||
delta = globalClock.getDt()
|
delta = base.clock.dt
|
||||||
move_x = delta * 3 * -self.keys['a'] + delta * 3 * self.keys['d']
|
move_x = delta * 3 * -self.keys['a'] + delta * 3 * self.keys['d']
|
||||||
move_z = delta * 3 * self.keys['s'] + delta * 3 * -self.keys['w']
|
move_z = delta * 3 * self.keys['s'] + delta * 3 * -self.keys['w']
|
||||||
self.camera.setPos(self.camera, move_x, -move_z, 0)
|
self.camera.setPos(self.camera, move_x, -move_z, 0)
|
||||||
|
@ -135,7 +135,7 @@ class Game(ShowBase):
|
|||||||
def update(self, task):
|
def update(self, task):
|
||||||
"""Updates the camera based on the keyboard input. Once this is
|
"""Updates the camera based on the keyboard input. Once this is
|
||||||
done, then the CellManager's update function is called."""
|
done, then the CellManager's update function is called."""
|
||||||
delta = globalClock.getDt()
|
delta = base.clock.dt
|
||||||
move_x = delta * 3 * -self.keys['a'] + delta * 3 * self.keys['d']
|
move_x = delta * 3 * -self.keys['a'] + delta * 3 * self.keys['d']
|
||||||
move_z = delta * 3 * self.keys['s'] + delta * 3 * -self.keys['w']
|
move_z = delta * 3 * self.keys['s'] + delta * 3 * -self.keys['w']
|
||||||
self.camera.setPos(self.camera, move_x, -move_z, 0)
|
self.camera.setPos(self.camera, move_x, -move_z, 0)
|
||||||
|
@ -120,7 +120,7 @@ class App(ShowBase):
|
|||||||
self.lblAction.hide()
|
self.lblAction.hide()
|
||||||
|
|
||||||
def moveTask(self, task):
|
def moveTask(self, task):
|
||||||
dt = globalClock.getDt()
|
dt = base.clock.dt
|
||||||
|
|
||||||
if not self.flightStick:
|
if not self.flightStick:
|
||||||
return task.cont
|
return task.cont
|
||||||
|
@ -145,7 +145,7 @@ class App(ShowBase):
|
|||||||
self.lblAction.hide()
|
self.lblAction.hide()
|
||||||
|
|
||||||
def moveTask(self, task):
|
def moveTask(self, task):
|
||||||
dt = globalClock.getDt()
|
dt = base.clock.dt
|
||||||
|
|
||||||
if not self.gamepad:
|
if not self.gamepad:
|
||||||
return task.cont
|
return task.cont
|
||||||
|
@ -128,7 +128,7 @@ class App(ShowBase):
|
|||||||
self.wheelCenter = self.wheel.findAxis(InputDevice.Axis.wheel).value
|
self.wheelCenter = self.wheel.findAxis(InputDevice.Axis.wheel).value
|
||||||
|
|
||||||
def moveTask(self, task):
|
def moveTask(self, task):
|
||||||
dt = globalClock.getDt()
|
dt = base.clock.dt
|
||||||
movementVec = Vec3()
|
movementVec = Vec3()
|
||||||
|
|
||||||
if not self.wheel:
|
if not self.wheel:
|
||||||
|
@ -45,7 +45,7 @@ class Avatar:
|
|||||||
# Get the time that elapsed since last frame. We multiply this with
|
# Get the time that elapsed since last frame. We multiply this with
|
||||||
# the desired speed in order to find out with which distance to move
|
# the desired speed in order to find out with which distance to move
|
||||||
# in order to achieve that desired speed.
|
# in order to achieve that desired speed.
|
||||||
dt = globalClock.getDt()
|
dt = base.clock.dt
|
||||||
|
|
||||||
# If the camera-left key is pressed, move camera left.
|
# If the camera-left key is pressed, move camera left.
|
||||||
# If the camera-right key is pressed, move camera right.
|
# If the camera-right key is pressed, move camera right.
|
||||||
|
@ -207,7 +207,7 @@ class Particle:
|
|||||||
start_vel=self.__texStartVel,
|
start_vel=self.__texStartVel,
|
||||||
velocities=self.__texCurrVel,
|
velocities=self.__texCurrVel,
|
||||||
accel=(0, 0, self.__gravity),
|
accel=(0, 0, self.__gravity),
|
||||||
start_time=globalClock.getFrameTime(),
|
start_time=base.clock.getFrameTime(),
|
||||||
emission_times=self.__texTimes,
|
emission_times=self.__texTimes,
|
||||||
part_duration=self.__partDuration,
|
part_duration=self.__partDuration,
|
||||||
image=loader.loadTexture(self.__texture))
|
image=loader.loadTexture(self.__texture))
|
||||||
|
@ -199,7 +199,7 @@ class RoamingRalphDemo(ShowBase):
|
|||||||
# Get the time that elapsed since last frame. We multiply this with
|
# Get the time that elapsed since last frame. We multiply this with
|
||||||
# the desired speed in order to find out with which distance to move
|
# the desired speed in order to find out with which distance to move
|
||||||
# in order to achieve that desired speed.
|
# in order to achieve that desired speed.
|
||||||
dt = globalClock.getDt()
|
dt = base.clock.dt
|
||||||
|
|
||||||
# If the camera-left key is pressed, move camera left.
|
# If the camera-left key is pressed, move camera left.
|
||||||
# If the camera-right key is pressed, move camera right.
|
# If the camera-right key is pressed, move camera right.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user