the node must only be the object you pick up when using physics in CC - like using Svens behavior.
Is that what your doing ?
For a simple stamina bar - create a 2d overlay based on percent is best.
The code is pretty simple -every 50ms or so:
var maxStamina = 4; // in this case 4% of screen width
var stamina = maxStamina;
if (playerStat == "run") {stamina -= 0.007;}
else if (playerStat == "walk") {stamina += 0.0024;}
else {stamina += 0.005;}
if (stamina > maxStamina) {stamina = maxStamina;}
if (stamina < 0) {stamina = 0;}
ccbSetSceneNodeProperty(stamN, "Width (percent)", stamina);
Hey Niven.
Thanks for the feedback - and purchase.
The new terrain walking API is out and I just now uploaded it here to itchio under that same asset you bought so have a look.
It comes with the ccb file and custom Behaviour all setup and working with terrain sounds....let me know if there are any problems.
Hi Sven - thanks for this - work well actually - better than my own version.
I notice using the physics engine of CC has issues with low ledges getting stuck on from the ground....and terrain walking is not smooth....any suggestions ??
I'm current looking at the source code but might actually be an issue with bullet physics maybe ??
Why not have a go at fixing this also yourself ?
Ok cool, thanks Sven.
I noticed the CopperCube method you (any myself) tried to determine if the player is hidden behind an object doesn't work very reliably as the collision line sent out from the alien to the player keeps going and wont stop at the player and so will typically find a collision somewhere further away and thus think the player is hidden when its not. Instead I had to work out the distance that same collision check is from the alien and also the distance from the alien to the player. If the player is further away than the collision found check then the player must be hidden behind something.....
cheers.
I made the other restricted version with all source files public - check it here: https://robo25.itch.io/coppercube-source-update