great tutorial of Platform game.
How I get data from PlatformCharacter?
Example: in SpiderEnemy onUpdate function I need to get facing value from PlatformCharacter. Is that possible?
I try to use "wade.getSceneObject("PlatformCharacter").facing" but it does not work.
I think in that tutorial we do not explicitly store the heading. We probably should do. However what we do is this: we look at the velocity at any time, and when velocity.x changes sign we change animation.
So you could use either the velocity (when the character is moving) or the animation name to determine the heading. With the character that we use in the tutorial (her name is inaura) you would do something like this:
var animationName = _.inaura.getSprite().getCurrentAnimationName(); // animationName will be something like "idle right" var heading = animationName.split(' ');
Actually that was wrong :) We DO store the heading, I just looked it up as I couldn't remember.
This should always be either 'left' or 'right'
Thank you. That worked like charm!