Jay McGavren's Journal

2009-08-20

Physics...

Video here.

    set_manager :physics, create_game_object(:BasicPhysicsManager)

    spawner = create :GameObject, :ReceivesEvents
    load_keymap :MouseKeymap
    spawner.handle_event :mouse_pressed do |message|
      object = create :GameObject, :Physical
      object.set_physical_debug_mode true
      case rand(2)
      when 0
        object.set_shape :Box, 10, 5
      when 1
        object.set_shape :Circle, 10
      end
      object.body_position = message.value.pointer
    end
comments powered by Disqus