Skip to content

Instantly share code, notes, and snippets.

View jaymcgavren's full-sized avatar

Jay McGavren jaymcgavren

View GitHub Profile
jay@dandelion:~/Projects/gemini.fresh
$ ./run-specs.sh
(in /Users/jay/Projects/gemini.fresh)
** Invoke spec (first_time)
** Execute spec
./src/behavior.rb:62:in `class_eval': ./src/behavior.rb:68: ,
unexpected tRPAREN (SyntaxError)
from ./src/behavior.rb:62:in `method_added'
from ./src/behaviors/spatial.rb:4
require 'listenable_mixin'
module Gemini
class MethodExistsError < Exception; end
class InvalidWrapWithCallbacksError < Exception; end
class ValueChangedEvent
attr_accessor :previous_value, :desired_value
def initialize(previous_value, desired_value)
$ ./run-specs.sh
(in /Users/jay/Projects/gemini.fresh)
** Invoke spec (first_time)
** Execute spec
Failed to evaluate code:
def position=(*arg1)
raise Gemini::InvalidWrapWithCallbacksError.new("Cannot wrap position= with callbacks without \"position\"") unless respond_to?(:position)
event = ValueChangedEvent.new(@target.position, *arg1)
callback_abort = CallbackStatus.new
@target.notify :before_position_changes, event
http://gist.github.com/169491
jay@dandelion:~/Projects/gemini.fresh
$ ./run-specs.sh
(in /Users/jay/Projects/gemini.fresh)
** Invoke spec (first_time)
** Execute spec
.......*......................Creating Rawr configuration file build_configuration.rb
build_configuration.rb
Creating Java class /Users/jay/Projects/gemini.fresh/spec_tmp/src/org/rubyforge/rawr/Main.java
Creating Rakefile ...
.......Creating Rawr configuration file build_configuration.rb
require 'spec_helper'
require 'managers/basic_game_object_manager'
describe 'BasicGameObjectManager' do
before :each do
@state = Jemini::BaseState.new(mock('Container', :null_object => true), mock('Game', :null_object => true))
@manager = BasicGameObjectManager.new(@state)
@state.send(:set_manager, :game_object, @manager)
end
require 'spec_helper'
require 'managers/basic_game_object_manager'
describe 'BasicGameObjectManager' do
before :each do
@state = Jemini::BaseState.new(mock('Container', :null_object => true), mock('Game', :null_object => true))
@manager = BasicGameObjectManager.new(@state)
@state.send(:set_manager, :game_object, @manager)
end
class ShellShooter < Jemini::Behavior
POWER_FACTOR = 120.0
def fire_weapon(power, angle)
begin
#TODO: configurable fire_from_distance to replace barrel anchor
shell = @target.game_state.create :Shell
# shell_offset = @target.barrel_anchor + Vector.new(0.0, -5.0 + @target.barrel_anchor.y)
shell_offset = Vector.new(0.0, -5.0 - @target.barrel_width)
shell_position = shell_offset.pivot_around_degrees(Vector::ORIGIN, @target.physical_rotation + angle)
//gist.github.com/206570
class Shell < Jemini::GameObject
has_behavior :PhysicalSprite
has_behavior :Taggable
has_behavior :TriangleTrailEmittable
attr_accessor :damage
@@active_shells = []
VELOCITY_TO_DAMAGE_RATIO = 0.05