New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AGS 4: Script API: implement FaceDirectionRatio #2304
AGS 4: Script API: implement FaceDirectionRatio #2304
Conversation
732c174
to
e68f64a
Compare
Added design-time properties for Game (in General Settings), Room and Walkable area. Two problems:
|
e68f64a
to
1237d1e
Compare
After #2307 added a script property to WalkableArea struct too. |
I just realized, that the Editor already has a workaround for floats implemented during serialization, a very long time ago: ags/Editor/AGS.Types/SerializeUtils.cs Lines 143 to 152 in b148832
ags/Editor/AGS.Types/SerializeUtils.cs Lines 241 to 250 in b148832
So, these values will save and load using InvariantCulture at least. The only issue remaining is how they are displayed in the property grid, but this may be a lesser priority. (I was not able to find how to apply the "culture" to a property grid control or particular fields, except for writing a custom typeconverter, which I don't like... |
Following a proposal by @messengerbag, allowed negative ratios, which basically swap up/down loops. This maybe will work for "going downhill" kind of effects in game. |
41ba7d0
to
4285767
Compare
Added a test game, with assets made by user who requested this feature recently: |
4285767
to
fe173ee
Compare
Having negative ratio will swap vertical loop selection (up/down), which is maybe suitable for "going down the hill" effects.
fe173ee
to
eaf695a
Compare
bb8316c
to
ddc9d21
Compare
In regards to this subtask:
I decided to leave this out, and only have couple TODOs in code. I found that with the current order of character update checking "area" under the feet will be called about same amount of times anyway; and caching things is often bug prone in AGS, as character state (like position) may be changed in a random script callback. So i'd rather leave this kind of improvement for later. |
Updated test game, now made by blaholtzen, with 2 characters featuring different face ratios: |
That demo game is super cute. It appears it works. I noticed no new property is added for the character in their properties in the Editor, is that intended? (I ask because of the comment above) |
I added this setting to GeneralSettings, Room and Walkable Area, but not the Character, because it seems that the common case for using the character's individual property is when scripting custom behavior. |
27a76bf
into
adventuregamestudio:ags4
Resolves #2243
This implements new property called FaceDirectionRatio for Game, Room, WalkableArea and Character. This property affects selection of directional loop while Character moves and turns.
Ratio's implementation is loosely based on the experimental commit in @AlanDrake 's custom "Draconian" engine. The meaning of ratio is (Y / X) relation. Default value is 1.0, where loop selection strictly corresponds to movement and facing dir. Values >1.0 mean that Y axis has more "weight", and vertical loops are chosen for the wider range of angles. Values <1.0 mean that X axis has more "weight", and horizontal loops are chosen for the wider range of angles.
This may be also illustrated with this pic:
The properties are checked in following order:
Potential TODOs:
[ ] Optimize direction ration calculation by caching few things in character class.Test game, made with assets by user who requested this feature recently:
IsoBikeDemo.zip