Module: Smalruby3::SpriteMethod::Sensing
- Included in:
- Smalruby3::Sprite
- Defined in:
- lib/smalruby3/sprite_method/sensing.rb
Overview
Sensing category methods
Instance Method Summary collapse
Instance Method Details
#touching?(object) ⇒ Boolean
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/smalruby3/sprite_method/sensing.rb', line 5 def touching?(object) case object when "_edge_" # TODO: check with rotation_center_{x,y}, costume {width,height}, costume transparent x <= SmalrubyToDXRuby::SCREEN_LEFT || x >= SmalrubyToDXRuby::SCREEN_RIGHT || y <= SmalrubyToDXRuby::SCREEN_BOTTOM || y >= SmalrubyToDXRuby::SCREEN_TOP when "_mouse_" # TODO: check touching mouse raise NotImplementedError, "touching?(\"#{object}\")" else if !sprite(object) # TODO: check touching sprite raise ArgumentError, "invalid object: #{object}" end end end |