Skip to main content

Get a Grip

·188 words·1 min

Inheritance Out, Composition In
#

Alright so what was the total line count yesterday?

$find . -type f -name '*.gd' | xargs wc -l
    6 ./components/laser_collidable.gd
   48 ./components/laser_collider.gd
    4 ./scripts/global_state.gd
    8 ./scripts/collidable.gd
  287 ./scripts/interactible.gd
   33 ./scripts/cursor_manager.gd
   18 ./scripts/constants.gd
   30 ./scripts/level_file_manager.gd
  113 ./scripts/drag_and_drop.gd
   43 ./scenes/level.gd
   18 ./scenes/mirror.gd
   29 ./scenes/level_change_ui.gd
  236 ./scenes/laser.gd
   18 ./scenes/prism_triangle.gd
   65 ./scenes/sensor.gd
    2 ./scenes/game_complete_popup.gd
   18 ./scenes/prism_rectangle.gd
   66 ./scenes/main.gd
   14 ./scenes/level_complete_popup.gd
   33 ./editor/create_wall_outlines.gd
 1089 total

Here are the new numbers after removing both DragAndDrop and Interactible in favour of using composition.

   14 ./components/laser_collidable.gd
   27 ./components/position_validation.gd
   67 ./components/drag_translation.gd
   68 ./components/drag_rotation.gd
   48 ./components/laser_collider.gd
    4 ./scripts/global_state.gd
    7 ./scripts/collidable.gd
   33 ./scripts/cursor_manager.gd
   23 ./scripts/constants.gd
   30 ./scripts/level_file_manager.gd
   31 ./scenes/level.gd
   29 ./scenes/level_change_ui.gd
  239 ./scenes/laser.gd
   63 ./scenes/sensor.gd
   66 ./scenes/main.gd
   14 ./scenes/level_complete_popup.gd
  763 total

So a little less than 300 fewer lines of code.

This didn’t really address the code bloat in the Laser class but I’m happy… for now. (-;

Grip Handles on a Triangle
#

Working on the drag handle grip texture for mirrors and prisms. I got them toggling on and off on hover but having trouble deciding where to put the grips on the triangle.

That doesn’t look right somehow.

How about..?