samples: Update globalClock references to base.clock

This commit is contained in:
rdb 2021-12-25 11:49:04 +01:00
parent eefcae7b05
commit f3c481578e
10 changed files with 10 additions and 10 deletions

View File

@ -202,7 +202,7 @@ class AsteroidsDemo(ShowBase):
def gameLoop(self, task):
# Get the time elapsed since the next frame. We need this for our
# distance and velocity calculations.
dt = globalClock.getDt()
dt = self.clock.dt
# If the ship is not alive, do nothing. Tasks return Task.cont to
# signify that the task should continue running. If Task.done were

View File

@ -266,7 +266,7 @@ class BallInMazeDemo(ShowBase):
def rollTask(self, task):
# Standard technique for finding the amount of time since the last
# frame
dt = globalClock.getDt()
dt = base.clock.dt
# 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

View File

@ -123,7 +123,7 @@ class Game(ShowBase):
def update(self, task):
"""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_z = delta * 3 * self.keys['s'] + delta * 3 * -self.keys['w']
self.camera.setPos(self.camera, move_x, -move_z, 0)

View File

@ -135,7 +135,7 @@ class Game(ShowBase):
def update(self, task):
"""Updates the camera based on the keyboard input. Once this is
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_z = delta * 3 * self.keys['s'] + delta * 3 * -self.keys['w']
self.camera.setPos(self.camera, move_x, -move_z, 0)

View File

@ -120,7 +120,7 @@ class App(ShowBase):
self.lblAction.hide()
def moveTask(self, task):
dt = globalClock.getDt()
dt = base.clock.dt
if not self.flightStick:
return task.cont

View File

@ -145,7 +145,7 @@ class App(ShowBase):
self.lblAction.hide()
def moveTask(self, task):
dt = globalClock.getDt()
dt = base.clock.dt
if not self.gamepad:
return task.cont

View File

@ -128,7 +128,7 @@ class App(ShowBase):
self.wheelCenter = self.wheel.findAxis(InputDevice.Axis.wheel).value
def moveTask(self, task):
dt = globalClock.getDt()
dt = base.clock.dt
movementVec = Vec3()
if not self.wheel:

View File

@ -45,7 +45,7 @@ class Avatar:
# 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
# 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-right key is pressed, move camera right.

View File

@ -207,7 +207,7 @@ class Particle:
start_vel=self.__texStartVel,
velocities=self.__texCurrVel,
accel=(0, 0, self.__gravity),
start_time=globalClock.getFrameTime(),
start_time=base.clock.getFrameTime(),
emission_times=self.__texTimes,
part_duration=self.__partDuration,
image=loader.loadTexture(self.__texture))

View File

@ -199,7 +199,7 @@ class RoamingRalphDemo(ShowBase):
# 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
# 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-right key is pressed, move camera right.