vstirbu on v0.17.1
vstirbu on master
bumped version (compare)
vstirbu on fix-typescript
vstirbu on master
fixed type Merge pull request #132 from vs… (compare)
vstirbu on fix-typescript
fixed type (compare)
vstirbu on fix-typescript
vstirbu on v0.17.0
vstirbu on master
0.17.0 (compare)
vstirbu on v0.17.0
vstirbu on v0.17.0
vstirbu on master
expanded type documentation (compare)
vstirbu on v0.17.0-alpha.3
vstirbu on master
alpha.3 (compare)
update
function for the game that ticks every frame:function update() {
hero.update();
//etc
}
@m59peacemaker, an example of using the ism for controlling the movement of the character in the game would be really useful! I have not used it myself together with a game engine so I would well come an exam ole like this.
I have a quick look at the example you provided, and I think that the general approach in this case is to use the facilities of the game engine to handle the interaction and rendering, while controlling the state of the character using the state machine. At first glance, the example already provides the complete state machine definition including the states and the possible transitions. They can be mapped quite easily:
var sm = StateMachine.create({
initial: 'standing',
events: [
{ name: 'move', from: 'standing', to: 'running'},
{ name: 'jump', from: ['running', 'standing'], to: 'jumping' }
// and so on with the rest as listed in the picture
],
callbacks: {
}
})
function running() {
// logic for every frame
}
function update() { // game loop
hero.render(); // set to "running" function when state is running
}