summaryrefslogtreecommitdiff |
diff options
author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2020-05-28 10:42:32 +0200 |
---|---|---|
committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2020-05-28 10:42:32 +0200 |
commit | 65d258b1b2b9bb02e7b4dec3637c5e138e11f0e6 (patch) | |
tree | 363b19c13df4459d2b94d9c349bb0bc2c75120c6 | |
parent | a57c213e5e642b3441b0dff9e8b6f5dc2bed5b27 (diff) |
Repairs the moving animations.
-rw-r--r-- | src/battle/src/Update/HandleServerReply.elm | 4 | ||||
-rw-r--r-- | src/battle/src/Update/Puppeteer.elm | 54 | ||||
-rw-r--r-- | src/css/src/battle/map/animation.scss | 2 |
3 files changed, 27 insertions, 33 deletions
diff --git a/src/battle/src/Update/HandleServerReply.elm b/src/battle/src/Update/HandleServerReply.elm index eb5e612..43b8185 100644 --- a/src/battle/src/Update/HandleServerReply.elm +++ b/src/battle/src/Update/HandleServerReply.elm @@ -186,7 +186,7 @@ add_to_timeline turn_results model = ( {model | puppeteer = - (List.foldl + (List.foldr (\turn_result puppeteer -> (Struct.Puppeteer.append_forward (Struct.PuppeteerAction.from_turn_result @@ -195,7 +195,7 @@ add_to_timeline turn_results model = puppeteer ) ) - model.puppeteer + (Struct.Puppeteer.set_is_playing_forward True model.puppeteer) turn_results ), battle = diff --git a/src/battle/src/Update/Puppeteer.elm b/src/battle/src/Update/Puppeteer.elm index f4fa8dd..b79cddb 100644 --- a/src/battle/src/Update/Puppeteer.elm +++ b/src/battle/src/Update/Puppeteer.elm @@ -163,18 +163,19 @@ apply_effects_backward effects model = effects ) --------------------------------------------------------------------------------- --- EXPORTED -------------------------------------------------------------------- --------------------------------------------------------------------------------- -apply_to : Struct.Model.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type)) -apply_to model = +apply_to_rec : ( + Struct.Model.Type -> + (List (Cmd Struct.Event.Type)) -> + (Struct.Model.Type, (Cmd Struct.Event.Type)) + ) +apply_to_rec model cmds = case (Struct.Puppeteer.maybe_get_current_action model.puppeteer) of - Nothing -> (model, (Cmd.none)) + Nothing -> (model, (Cmd.batch cmds)) (Just action) -> case action of (Struct.PuppeteerAction.Perform effects) -> let - (new_model, cmds) = + (new_model, new_cmds) = ( if (Struct.Puppeteer.get_is_playing_forward @@ -184,16 +185,11 @@ apply_to model = else (apply_effects_backward effects model) ) in - ( - new_model, - if (List.isEmpty cmds) - then (Cmd.none) - else (Cmd.batch cmds) - ) + (apply_to_rec new_model (new_cmds ++ cmds)) (Struct.PuppeteerAction.PerformFor (time, effects)) -> let - (new_model, cmds) = + (new_model, new_cmds) = ( if (Struct.Puppeteer.get_is_playing_forward @@ -205,22 +201,20 @@ apply_to model = in ( new_model, - if (List.isEmpty cmds) - then - (Delay.after - time - Delay.Second - Struct.Event.AnimationEnded - ) - else - (Cmd.batch - ( - (Delay.after - time - Delay.Second - Struct.Event.AnimationEnded - ) - :: cmds + (Cmd.batch + ( + (Delay.after + time + Delay.Second + Struct.Event.AnimationEnded ) + :: (new_cmds ++ cmds) ) + ) ) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +apply_to : Struct.Model.Type -> (Struct.Model.Type, (Cmd Struct.Event.Type)) +apply_to model = (apply_to_rec model []) diff --git a/src/css/src/battle/map/animation.scss b/src/css/src/battle/map/animation.scss index eef2913..6b20655 100644 --- a/src/css/src/battle/map/animation.scss +++ b/src/css/src/battle/map/animation.scss @@ -1,4 +1,4 @@ -.animated-character-icon +.character-icon { transition: top linear 0.3s, left linear 0.3s; } |