Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
So, I am going to take a bash at scripting fall damage.. The idea is to calculate the distance between colision of the player and any other object on the verticle access. If the distance is over a certain limit, health will be deducted as based on the distance... Does anyone have any better ideas before I give this a bash? |
||||
|
i hear ya, I got fall damage on my 'to do' list as well but I just haven't got around to it yet...my first thought was to calculate the time it takes to fall rather than the distance, but maybe you are more correct |
||||
|
Ok, so here is my code and it works First set a coppercube variable...I called mine "Altitiude" Then run this code every second using the looped interval behavior (Can't remember what it is called) --------------------------------------------------------------------------------- var LastAltitude = ccbGetCopperCubeVariable("Altitude"); print(LastAltitude); var s = ccbGetSceneNodeFromName("Camera1"); var position = ccbGetSceneNodeProperty(s, "Position"); ccbSetCopperCubeVariable("Altitude", position.y) var currentAlt = position.y; currentAlt = currentAlt + 60; if(LastAltitude > currentAlt) { print("Died"); }else { print("Working"); } ------------------------------------------------------------------------- That's all |
||||
|
Oh yea, forgot to mention that I used gravity of 10 and a 1 second interval on loop behavior |
||||
|
hm, not quite how I would implement it, but could be useful... thanks for sharing! |
|