ippa / chingu

OpenGL accelerated 2D game framework for Ruby
http://ippa.se/chingu
GNU Lesser General Public License v2.1
308 stars 66 forks source link

Line of sight #58

Closed sirbrillig closed 11 years ago

sirbrillig commented 11 years ago

Add methods to GameObjectMap to find line-of-sight between objects. Specifically: #collisions_with, #each_game_object_between, #game_object_between?, #game_object_at, and #grid_spaces_between.

Here's an example of its use:

player.sees_enemy if game_object_map.game_object_between?(player, enemy, :only => Wall) # Walls block vision

Also another small change to GameObject#load_game_objects to specify the exception that caused the error. I have a further (commented-out) suggestion to re-raise such errors, but that is outside the scope of this branch.

ippa commented 11 years ago

Hi, back from from skiptrip. Looks good.. but could you rename the object_* methods to gameobject* to be more in line with chingus naming? Also some basic tests would be nice :) ..

sirbrillig commented 11 years ago

Done and done. :-)

ippa commented 11 years ago

nice! :D