Game Development Reference
In-Depth Information
color = Gosu :: Color :: RED
t_x, t_y = Utils . point_at_distance(x, y, @object . gun_angle,
BulletPhysics :: MAX_DIST )
$window . draw_line(x, y, color, t_x, t_y, color, 1000 )
end
end
# ...
end
Finally, you can automatically mark collision box corners on your graphics components.
Let's take BoxGraphics for example:
# 13-advanced-ai/misc/utils.rb
module Utils
# ...
def self . mark_corners (box)
i = 0
box . each_slice( 2 ) do | x, y |
color = DEBUG_COLORS [ i ]
$window . draw_triangle(
x - 3 , y - 3 , color,
x, y, color,
x + 3 , y - 3 , color,
100 )
i = (i + 1 ) % 4
end
end
# ...
end
# 13-advanced-ai/entities/components/box_graphics.rb
class BoxGraphics < Component
# ..
def draw (viewport)
@box . draw_rot(x, y, 0 , object . angle)
Utils . mark_corners(object . box) if $debug
end
# ...
end
As a developer, you can make yourself see nearly everything you want, make use of it.
Search WWH ::




Custom Search