Rotatable Doodads #82

Open
opened 2022-05-08 17:42:59 +00:00 by kirsle · 0 comments

Some ideas how doodads can opt-in to be rotate-able, examples:

  • Buttons are all drawn to be placed on floors, but could rotate them in 90 degree increments to put on ceilings/walls without needing duplicate sprites for each direction.
  • New directional doodads like Springs could benefit from being rotatable.
  • The 4x trapdoors could be trimmed down to 1x that can rotate.

How doodads opt in?

  • A doodad json property like Rotatable int (default 0 = can't rotate, otherwise specify the degrees of rotation supported, 45, 90, etc.
  • Update: commit 701073ce adds Doodad Options support, a doodad can define a "rotation" option (name arbitrary), handle the integer how it wants, and (in JavaScript) call a function like Self.SetRotation()

How to rotate a doodad in your level?

  • Actor Tool, mouse over a doodad: instead of whole doodad getting an orange outline (to click & drag it), add small buttons to click on that rotates it?
  • A dedicated Rotator tool? when selected, doodads that can't rotate mute out in color, click a doodad to rotate it.
  • Update: with the Doodad Options support, you just click on the Actor Properties button (on mouseover of the doodad) and go to the Options tab.

How it looks to the doodad scripts?

  • Can rotation be done transparently? e.g., actor collide events automatically adapt coordinates to undo the rotation so the actor script is written to assume a default rightside up orientation
  • Otherwise the actor script can query its rotation value and handle the logic itself

https://wiki.libsdl.org/SDL_RenderCopyEx

Some ideas how doodads can opt-in to be rotate-able, examples: * Buttons are all drawn to be placed on floors, but could rotate them in 90 degree increments to put on ceilings/walls without needing duplicate sprites for each direction. * New directional doodads like Springs could benefit from being rotatable. * The 4x trapdoors could be trimmed down to 1x that can rotate. How doodads opt in? * A doodad json property like Rotatable int (default 0 = can't rotate, otherwise specify the degrees of rotation supported, 45, 90, etc. * **Update:** commit 701073ce adds Doodad Options support, a doodad can define a "rotation" option (name arbitrary), handle the integer how it wants, and (in JavaScript) call a function like Self.SetRotation() How to rotate a doodad in your level? * Actor Tool, mouse over a doodad: instead of whole doodad getting an orange outline (to click & drag it), add small buttons to click on that rotates it? * A dedicated Rotator tool? when selected, doodads that can't rotate mute out in color, click a doodad to rotate it. * **Update:** with the Doodad Options support, you just click on the Actor Properties button (on mouseover of the doodad) and go to the Options tab. How it looks to the doodad scripts? * Can rotation be done transparently? e.g., actor collide events automatically adapt coordinates to undo the rotation so the actor script is written to assume a default rightside up orientation * Otherwise the actor script can query its rotation value and handle the logic itself https://wiki.libsdl.org/SDL_RenderCopyEx
kirsle added the
enhancement
label 2022-05-08 17:42:59 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: SketchyMaze/doodle#82
There is no content yet.