def test(): rabbyt.add_time(.1) anim.get() anim.get() anim.get() anim.get() anim.get() anim.get()
def gameUpdate(self, dt): """ To be called every Tick """ self.recvServer() rabbyt.add_time(dt) default_system.update(dt) for name, po in self.players.items(): delete_keys=[] for k, k_pressed in po.keys.iteritems(): if k_pressed and k in po.input: action = po.input[k][0] arg = po.input[k][1] po.action(action, arg, dt)
def update(self, dt): """ The ever-important update method is called every 1/60 seconds. Step through all the important game objects and update their position. Perform physics and collision detection. """ rabbyt.add_time(dt) self.tick += 1 self.player.update(dt) self.world.update(dt) self.camera.update(self.player.pos, 0) self.player.target = self.camera + self.cursor [r.update(dt) for r in self.robots] bullet.pool.update(dt) # fx.gibber.target.x, fx.gibber.target.y = self.player.pos.x, self.player.pos.y fx.update(dt) self.collide()
s.x = rabbyt.lerp(-275, -125, dt=3, extend="repeat") s.y = 480/2-50 sprites.append(s) sprites.append(FontSprite(font, "ease", x=-275, y=480/2-70)) sprites.append(FontSprite(font, "ease_out", x=-20, y=480/2-70)) sprites.append(FontSprite(font, "ease_in", x=235, y=480/2-70)) methods = ["sine", "quad", "cubic", "circ", "back", "bounce"] ypos = 480/2-100 for method in methods: sprites.append(FontSprite(font, method, x=-390, y=ypos)) for func, start, end in [(rabbyt.ease, -275, -125), (rabbyt.ease_out, -20, 130), (rabbyt.ease_in, 235, 385)]: sprites.append(rabbyt.Sprite(x=start, y=ypos-10)) sprites.append(rabbyt.Sprite(x=end, y=ypos-10)) s = rabbyt.Sprite() s.x = func(start, end, dt=3, extend="repeat", method=method) s.y = ypos-10 sprites.append(s) ypos -= 30 c = pygame.time.Clock() while not pygame.event.get(pygame.QUIT): rabbyt.add_time(c.tick(40)/1000.0) rabbyt.clear() rabbyt.render_unsorted(sprites) pygame.display.flip()