Ensure that animations never run in observer mode#885
Ensure that animations never run in observer mode#885TomWerner wants to merge 1 commit intoDevelopmentfrom
Conversation
stavrosfa
left a comment
There was a problem hiding this comment.
Do we want to bake the observer mode not having animations in the code? I think this is more of an Animation issue and that all the units are moving at the same time.
That being said, I don't mind this, but I'd rather put it in the animateAsync method in MapUnit and Tile with something like
if (EngineStorage.animationsEnabled && !EngineStorage.gameData.observerMode)
or in one single place in the AnimationTracker startAnimation method
if (EngineStorage.gameData.observerMode) return;
this doesn't actually work, I suspect it doesn't pass the if (EngineStorage.animationsEnabled) check in MapUnit
If that works for you, I think it would be preferable, let me know what you think.
Perhaps also a TODO to have a future look at it if we "fix" the animations would be useful.
Now that I tthink of, another TODO for an configuration/preferences option to choose if animations are enabled/disabled in obvserver mode would come in handy someday
|
Have you tried other ways of dealing with this input collision? You can try to add an action for toggling observer mode to the Godot InputMap instead of manually handling the key combination for it. AFAIK, the engine should be able to resolve the collision and won't trigger two actions for the same key stroke. https://docs.godotengine.org/en/stable/tutorials/inputs/input_examples.html#inputmap |
|
I had the exact opposite experience with Godot, I have left a comment here as well regarding this. This also seems to suggest the same way, check for pressing Am I getting this wrong? I don't think the best way to handle inputs is manually, but it seems to be the only way. |
|
@stavrosfa Hm, I've the reread documentation for Input.IsActionJustPressed, and it seems that by default it doesn't take modifier keys (Shift, Alt, Control) into account. It allows to pass a flag to toggle this behavior https://docs.godotengine.org/en/4.4/classes/class_input.html#class-input-method-is-action-just-pressed Maybe calling this method with |
|
I tried to do where the and it doesn't seem to make a difference with the current setup. If I release Shift last from the keyboard, it enables the animations. If I release another key last, the animations stay disabled. Not exactly a scientific way to try this, but hey 😅 EDIT: Do I need to pass the |
See the added code comment - observer mode now happily chugs along on my little chromebook.
560c65a to
aad429d
Compare
Yeah, that seems reasonable. Done |
stavrosfa
left a comment
There was a problem hiding this comment.
There is also this here
Prototype/C7Engine/C7GameData/Tile.cs
Line 754 in 546a91a
I think we would want that too, if anything, for consistency
Feel free to merge this btw
This avoids any issues with the "shift" key toggling animations colliding with the "ctrl+alt+shift+o" shortcut for observer mode.