diff --git a/resource/kitty.animation.json b/resource/kitty.animation.json index b1b70dd..2d2e948 100644 --- a/resource/kitty.animation.json +++ b/resource/kitty.animation.json @@ -1,5 +1,5 @@ { - "frameRate": 0.3, + "frameRate": 0.12, "frameCount": 3, "frameSize": [16, 16], "directionCount": 4, diff --git a/server/create-server-room.js b/server/create-server-room.js index 387e8f6..b4c94bd 100644 --- a/server/create-server-room.js +++ b/server/create-server-room.js @@ -45,9 +45,14 @@ const behaviorInvoke = (path, args) => { // Behaviors! const move = behaviorInvoke(['entity', 'moveFor'], [ - behaviorInvoke(['global', 'randomNumber'], [0.25, 1, false]) + behaviorInvoke(['global', 'randomNumber'], [0.25, 2.5, false]) ]); +const stopAnimating = behaviorTraversal( + ['entity', 'isAnimating'], + false +); + const firstWait = behaviorInvoke(['global', 'wait'], [ behaviorInvoke(['global', 'randomNumber'], [1, 4, false]) ]); @@ -61,6 +66,10 @@ const secondWait = behaviorInvoke(['global', 'wait'], [ behaviorInvoke(['global', 'randomNumber'], [0.5, 3, false]) ]); +const startAnimating = behaviorTraversal( + ['entity', 'isAnimating'], + true +); // A fire. function fireJSON(position) { @@ -206,9 +215,11 @@ function kittyJSON(position) { type: 'actions', traversals: [ move, + stopAnimating, firstWait, turn, secondWait, + startAnimating, ], } }, @@ -297,16 +308,12 @@ function mamaKittyJSON(position) { maxLife: 5000, }; traits.animated.params.animations.idle.offset = [0, -8]; - traits.behaved.params.routines.routines.initial.routine.traversals = [ - move, - firstWait, - turn, + traits.behaved.params.routines.routines.initial.routine.traversals.push(...[ storeJSON, setJSONX, setJSONY, spawn, - secondWait, - ]; + ]); traits.visible.state.visibleScale = [2, 2]; traits.shaped.params.shape.size = [16, 8]; traits.spawner = {