[Open Assets] Directionchar - 2.2's player angling system in 2.1!

This content may be freely modified and/or maintained by anyone.

Lach

he/him
Moderator
Sonic Team Junior
Kart Krew™️
Judge
In SRB2 version 2.2, players face the direction of their button inputs by default, rather than the camera angle. This has been brought to 2.1 before, but during development on Pointy Sonic, Chrispy and I decided to do our own take with the character in mind!

attachment.php

attachment.php


You can use the console command directionchar to turn it on and off as you please.

If you choose to play with it on, there are two other commands you can use as well:
By default, abilities like thok and glide still travel in the direction of the camera. Turning the command anglethok on will make certain character abilities face the direction the player is facing instead. This may be useful for players who want an option in between default tank controls and analog mode!

attachment.php


By default, players return to the camera's angle while standing still. Turning the command anglestand on will let standing players keep their angle while standing, also in a similar fashion to analog mode! (Chrispy and I like this feature in particular.)

attachment.php

Here are some other cool things that make this version stand out from other scripted versions of the feature:
attachment.php

attachment.php

attachment.php

Supporting this script with custom characters:
Where possible, use player.cmd.turnangle << FRACBITS instead of player.mo.angle. The script rotates the player mobj, so any ThinkFrame hooks that run after this script is added will use the new angle instead of the natural camera angle.

Should you need full control of mo.angle or need to disable directionchar for any other reason, setting the variable player.directionchar_override to true will prevent the rotation from taking effect. The script resets this variable every tic, so all you have to do is force player.directionchar_override to be true for every tic you need it disabled. It is recommended that you do this in a MobjThinker hook to guarantee that the variable is set before this script's ThinkFrame hook.

In MOST cases, all character mods should be loaded before directionchar, so it does not run before any logic the character needs regarding the player's angle. In certain situations however, it may be beneficial to add the character after directionchar—notably in the case of TailsCD, who will only display his tails correctly if directionchar is added before him.
 

Attachments

  • srb20274.gif
    srb20274.gif
    5.1 MB · Views: 5,346
  • srb20274.gif
    srb20274.gif
    5.1 MB · Views: 7,870
  • srb20278.gif
    srb20278.gif
    6.6 MB · Views: 4,458
  • srb20278.gif
    srb20278.gif
    6.6 MB · Views: 5,031
  • srb20275.gif
    srb20275.gif
    3.8 MB · Views: 4,877
  • srb20275.gif
    srb20275.gif
    3.8 MB · Views: 3,898
  • srb20277.gif
    srb20277.gif
    4.5 MB · Views: 6,028
  • srb20277.gif
    srb20277.gif
    4.5 MB · Views: 8,286
  • srb20279.gif
    srb20279.gif
    6.8 MB · Views: 3,967
  • srb20279.gif
    srb20279.gif
    6.8 MB · Views: 4,663
  • srb20280 copy.gif
    srb20280 copy.gif
    3.7 MB · Views: 4,241
  • srb20280 copy.gif
    srb20280 copy.gif
    3.7 MB · Views: 5,340
  • srb20280.gif
    srb20280.gif
    6.3 MB · Views: 4,961
  • srb20280.gif
    srb20280.gif
    6.3 MB · Views: 3,900
  • directionchar.lua
    5.8 KB · Views: 1,529
  • directionchar.lua
    5.8 KB · Views: 1,332
Last edited:
This script rocks!


Unfortunately, it breaks Ray's Air Glide a little bit.
 
This script rocks!


Unfortunately, it breaks Ray's Air Glide a little bit.

I don't want to add support for specific characters, since that would likely mean I would have to update this every time a new character releases. There is instead a means for character creators to disable directionchar temporarily, if they so wish to. Pointy uses this feature to disable the script while he uses his fan rotation frame.
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top