def main(): pygame.init() world = World(screen_size=(600, 600), one_second=1000.) ball = Ball() ball.set_pos(pymunk.Vec2d(2.0, 8.0)) ball.body.velocity = pymunk.Vec2d(1.0, 1.0) world.add(ball) while True: for event in pygame.event.get(): if event.type == pygame.QUIT: return world.step() world.draw()
from pyglet.gl import * from GameObject import * from World import World from utils.graphics import KEY # --- world = World(1200, 800) world.add(Soldier(600,400)) world.add(Enemy(800,700)) # --- def on_key_press(symbol, modifiers): if symbol == KEY.SPACE: Soldier.predictive_aiming = not Soldier.predictive_aiming elif symbol in Soldier.weapon_types: Soldier.weapon = Soldier.weapon_types[symbol] # --- def on_mouse_motion(x, y, dx, dy): world.mouse_position = Vector2D(x, y) # --- def on_mouse_press(x, y, button, modifiers): world.add(Enemy(x,y))
from pyglet.gl import * from GameObject import * from World import World from utils.graphics import KEY # --- world = World(1200, 800) soldier = Soldier(600, 400) soldier.add_waypoint(800, 500) soldier.add_waypoint(800, 600) soldier.add_waypoint(400, 400) world.add(soldier) world.add(Enemy(800, 700)) # --- def on_key_press(symbol, modifiers): if symbol == KEY.SPACE: Soldier.predictive_aiming = not Soldier.predictive_aiming elif symbol in Soldier.weapon_types: Soldier.weapon = Soldier.weapon_types[symbol] # --- def on_mouse_motion(x, y, dx, dy):