mirror of
https://github.com/quantum5/punyverse.git
synced 2025-04-24 13:11:57 -04:00
Added pausing and proper entity speed.
This commit is contained in:
parent
fb70fcf797
commit
6176a7f8cb
|
@ -55,9 +55,10 @@ class Applet(pyglet.window.Window):
|
||||||
cam.roll -= 4
|
cam.roll -= 4
|
||||||
cam.move(self.speed)
|
cam.move(self.speed)
|
||||||
|
|
||||||
framedata.tick += self.tick
|
if self.running:
|
||||||
for entity in self.world.tracker:
|
framedata.tick += self.tick
|
||||||
entity.update()
|
for entity in self.world.tracker:
|
||||||
|
entity.update()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(Applet, self).__init__(*args, **kwargs)
|
super(Applet, self).__init__(*args, **kwargs)
|
||||||
|
@ -69,6 +70,7 @@ class Applet(pyglet.window.Window):
|
||||||
self.info = True
|
self.info = True
|
||||||
self.debug = False
|
self.debug = False
|
||||||
self.orbit = True
|
self.orbit = True
|
||||||
|
self.running = True
|
||||||
|
|
||||||
self.tick = 1
|
self.tick = 1
|
||||||
# On standard world: 10x is one day per second, 100x is 10 days, 300x is a month
|
# On standard world: 10x is one day per second, 100x is 10 days, 300x is a month
|
||||||
|
@ -181,6 +183,8 @@ class Applet(pyglet.window.Window):
|
||||||
self.debug = not self.debug
|
self.debug = not self.debug
|
||||||
elif symbol == key.O:
|
elif symbol == key.O:
|
||||||
self.orbit = not self.orbit
|
self.orbit = not self.orbit
|
||||||
|
elif symbol == key.ENTER:
|
||||||
|
self.running = not self.running
|
||||||
elif symbol == key.INSERT:
|
elif symbol == key.INSERT:
|
||||||
index = self.ticks.index(self.tick) + 1
|
index = self.ticks.index(self.tick) + 1
|
||||||
if index < len(self.ticks):
|
if index < len(self.ticks):
|
||||||
|
@ -189,10 +193,10 @@ class Applet(pyglet.window.Window):
|
||||||
index = self.ticks.index(self.tick) - 1
|
index = self.ticks.index(self.tick) - 1
|
||||||
if index >= 0:
|
if index >= 0:
|
||||||
self.tick = self.ticks[index]
|
self.tick = self.ticks[index]
|
||||||
elif symbol == key.Q:
|
elif symbol == key.SPACE:
|
||||||
c = self.cam
|
c = self.cam
|
||||||
dx, dy, dz = c.direction()
|
dx, dy, dz = c.direction()
|
||||||
speed = max(1, abs(self.speed) * 0.6)
|
speed = self.speed * 1.1 + 5
|
||||||
dx *= speed
|
dx *= speed
|
||||||
dy *= speed
|
dy *= speed
|
||||||
dz *= speed
|
dz *= speed
|
||||||
|
|
Loading…
Reference in a new issue