Game Development Reference
In-Depth Information
9 @image . draw_rot(x, y, 0 , @angle )
10 end
11
12
private
13
14 def images
15
@@images ||= ( 1. . 4 ) . map do | i |
Gosu :: Image . new( $window ,
16
Utils . media_path( "damage #{ i } .png" ), false )
17
18 end
19 end
20 end
Explosion will be responsible for creating Damage instances on solid ground, just
before explosion animation starts:
class Explosion < GameObject
def initialize (object_pool, x, y)
# ...
if @object_pool . map . can_move_to?(x, y)
Damage . new( @object_pool , @x , @y )
end
# ...
end
# ...
end
And this is how the result looks like:
Damaged battlefield
Search WWH ::




Custom Search