feat: behaving kitteh

This commit is contained in:
cha0s 2019-04-09 10:43:51 -04:00
parent 95ed06a221
commit a2295ed038

View File

@ -39,6 +39,38 @@ function flowerBarrelJSON(position) {
}
// A kitteh.
function kittyJSON(position) {
const buildRandom = (min, max, floor = true) => {
return {
type: 'traversal',
steps: [
{
type: 'key',
key: 'global',
},
{
type: 'key',
key: 'randomNumber',
},
{
type: 'invoke',
args: [
{
type: 'literal',
value: min,
},
{
type: 'literal',
value: max,
},
{
type: 'literal',
value: floor,
},
],
},
],
};
}
return {
traits: {
animated: {
@ -51,6 +83,87 @@ function kittyJSON(position) {
}
},
},
behaved: {
params: {
routines: {
initial: {
actions: [
{
type: 'action',
steps: [
{
type: 'key',
key: 'entity',
},
{
type: 'key',
key: 'moveFor',
},
{
type: 'invoke',
args: [
buildRandom(0.25, 1, false),
],
},
],
},
{
type: 'action',
steps: [
{
type: 'key',
key: 'global',
},
{
type: 'key',
key: 'wait',
},
{
type: 'invoke',
args: [
buildRandom(1, 4),
],
},
],
},
{
type: 'action',
steps: [
{
type: 'key',
key: 'entity',
},
{
type: 'key',
key: 'direction',
},
],
value: buildRandom(0, 3),
},
{
type: 'action',
steps: [
{
type: 'key',
key: 'global',
},
{
type: 'key',
key: 'wait',
},
{
type: 'invoke',
args: [
buildRandom(0.5, 3),
],
},
],
},
],
},
},
},
},
collider: {},
directional: {
params: {
@ -64,7 +177,7 @@ function kittyJSON(position) {
graphical: {},
mobile: {
state: {
speed: 80,
speed: 40,
},
},
physical: {},