fix: kitties

This commit is contained in:
cha0s 2019-04-21 03:43:20 -05:00
parent 19ec755e67
commit 3c2bf6d6a9
2 changed files with 15 additions and 8 deletions

View File

@ -1,5 +1,5 @@
{ {
"frameRate": 0.3, "frameRate": 0.12,
"frameCount": 3, "frameCount": 3,
"frameSize": [16, 16], "frameSize": [16, 16],
"directionCount": 4, "directionCount": 4,

View File

@ -45,9 +45,14 @@ const behaviorInvoke = (path, args) => {
// Behaviors! // Behaviors!
const move = behaviorInvoke(['entity', 'moveFor'], [ 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'], [ const firstWait = behaviorInvoke(['global', 'wait'], [
behaviorInvoke(['global', 'randomNumber'], [1, 4, false]) behaviorInvoke(['global', 'randomNumber'], [1, 4, false])
]); ]);
@ -61,6 +66,10 @@ const secondWait = behaviorInvoke(['global', 'wait'], [
behaviorInvoke(['global', 'randomNumber'], [0.5, 3, false]) behaviorInvoke(['global', 'randomNumber'], [0.5, 3, false])
]); ]);
const startAnimating = behaviorTraversal(
['entity', 'isAnimating'],
true
);
// A fire. // A fire.
function fireJSON(position) { function fireJSON(position) {
@ -206,9 +215,11 @@ function kittyJSON(position) {
type: 'actions', type: 'actions',
traversals: [ traversals: [
move, move,
stopAnimating,
firstWait, firstWait,
turn, turn,
secondWait, secondWait,
startAnimating,
], ],
} }
}, },
@ -297,16 +308,12 @@ function mamaKittyJSON(position) {
maxLife: 5000, maxLife: 5000,
}; };
traits.animated.params.animations.idle.offset = [0, -8]; traits.animated.params.animations.idle.offset = [0, -8];
traits.behaved.params.routines.routines.initial.routine.traversals = [ traits.behaved.params.routines.routines.initial.routine.traversals.push(...[
move,
firstWait,
turn,
storeJSON, storeJSON,
setJSONX, setJSONX,
setJSONY, setJSONY,
spawn, spawn,
secondWait, ]);
];
traits.visible.state.visibleScale = [2, 2]; traits.visible.state.visibleScale = [2, 2];
traits.shaped.params.shape.size = [16, 8]; traits.shaped.params.shape.size = [16, 8];
traits.spawner = { traits.spawner = {