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!
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:
Here are some other cool things that make this version stand out from other scripted versions of the feature:
Supporting this script with custom characters:
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.
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!
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.)
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.)
Here are some other cool things that make this version stand out from other scripted versions of the feature:
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.
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.gif5.1 MB · Views: 5,378
-
srb20274.gif5.1 MB · Views: 7,964
-
srb20278.gif6.6 MB · Views: 4,471
-
srb20278.gif6.6 MB · Views: 5,068
-
srb20275.gif3.8 MB · Views: 4,908
-
srb20275.gif3.8 MB · Views: 3,905
-
srb20277.gif4.5 MB · Views: 6,041
-
srb20277.gif4.5 MB · Views: 8,392
-
srb20279.gif6.8 MB · Views: 3,978
-
srb20279.gif6.8 MB · Views: 4,689
-
srb20280 copy.gif3.7 MB · Views: 4,259
-
srb20280 copy.gif3.7 MB · Views: 5,380
-
srb20280.gif6.3 MB · Views: 4,987
-
srb20280.gif6.3 MB · Views: 3,910
-
directionchar.lua5.8 KB · Views: 1,546
-
directionchar.lua5.8 KB · Views: 1,347
Last edited: