-
Notifications
You must be signed in to change notification settings - Fork 0
Demo 04 Construction
Demo 04 contains an Interact/Dialog driven character entity. The entity triggers the basic Animation (link pending) system and is able to toggle the state of the player entity.

| Setting | Value |
|---|---|
| char | mrblue |
The character in this level is capable of toggling the size of the player entity through a combination of the Dialog and Animation systems.
NOTE: In Weltmeister other fields are appearing in relation to the char object but they are not hand configured (needs to be investigated).
The character data consists of a name field and a standard interact.
Characters.mrblue =
{
n:'mrblue', // entity name to assign
i:
{
d:'characters.mrblue', // dialog
ht: 'Mr. Blue', // character name (shown in hud if able to interact and this is specified)
ao: // animation object
{
i:'boxblue', // image name ('media/' is prepended)
w:16, // width of frame
h:16, // height of frame
a: // array of animation states
[
{
n:'idle',
ft:1, // frametime
seq:[0] // sequence
},
{
n:'run',
ft:1, // frametime
seq:[0] // sequence
}
]
}
}
}
The dialog data is fairly simple. The entire dialog is sequential and the first state is never revisited due to flags to avoid doing so. The only matter of new complexity is the use of the Dialog Animation Action specified in the second state if the player selects "Yes!"
Dialogs.characters.mrblue =
{
s:mrBlueBase,
sa:
[
{
n:'intro',
r:{i:[['c','mrblue', '==0']]},
a:{sv:[['c','mrblue', 1]]},
t:"Hey man I'm literally blue. It's a lame joke so I won't repeat it if you talk to me again.",
ns:'normal'
},
{
n:'normal',
t:"Want me to toggle your size?",
o:
[
{
t:"Yes!",
a:
{
anim:'sparkle',
}
},
{
t:"Nope!",
}
]
}
]
}
The sparkle animation moves the player around the character entity with an offset of 6 (either left or right of the initiating entity, the character in this case). Then on the 8th frame the animAction function is called on the player entity. The player entity then toggles it's state internally. More details can be found in Animation.
Animations.sparkle =
{
s: // settings
{
fa:true, // flipped allowed (meaning the offset entity can meet the requirements on the left/right)
dc:true // disable player controls (no input)
},
es: // entity specific settings
[
// NOTE: the first entity is the static entity around which the others must move
{
n:'_initiator', // name of the entity '_initiator' is a special indicator of the entity that started the animation
},
{
n:'player',
x:6, // xoffset from the static entity (default: 0)
y:0, // yoffset from the static entity (default: 0)
},
],
ao: // animation object
{
i:'sparkle', // image name ('media/' is prepended)
w:8, // width of frame
h:8, // height of frame
a: // array of animation states (should only have 1)
[
{
n:'swing', // Note name is non-critical in current implementation
ft:0.1, // frametime
seq:[0, 0, 0, 0, 1, 2, 0, 1, 2, 3], // sequence
actseq:
[
{ f:8, e:'player', k:'ps' } // on frame 8 (or higher if skipped, execute the animAction on the player
],
s:true
}
]
}
}