Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I am creating FPS game and when the player gat's high and jumps down, he get's no damage! In good games like IGI the player get's damage when he jumps from high places. In simple words can Fall damage be possible in Coppercube??? |
||||
|
Maybe this post can help you out.... https://www.ambiera.com/forum.ph... |
||||
|
I took a closer look at that script but it seems to me that when our altitude will be high and when player will jump from there, player will die!! I need: When player is at 10 altitude, player will get 10 damage When player is at 30 altitude, player will get 30 damage When player is at 60 altitude, player will get 60 damage And so on..... And When player is at 100 altitude, player will die. |
||||
|
You can use variable for that....or you can use my precreated behaviour to check the altitude then compare it or you can script something like this by yourself.... Here is the link to the post containing my behaviour..... https://ambiera.com/forum.php?t=... https://ambiera.com/forum.php?t=... Link to another intresting post... https://www.ambiera.com/forum.ph... |
||||
|
You gave me the behavior_altitude.js but it is only to show the height not to get the damage.... |
||||
|
No answer... |
||||
|
You will likely have to do some programming yourself or hire someone. Like my problems, at some point in game creation you have to get your hands dirty if you're a one man show. Mike |
||||
|
Exactly what I did for a double jump feature. |
||||
|
i have already answered you @behroz khan and provided you with the solution on some other post...all you are doing is asking again and again the same thing on different post... while the solution to your issue has already been provided to you.. am not saying that don't ask questions all am saying is please try the solutions provided to you before repeating your question.. |
||||
|
I have tried but it only shows altitude and do not takes damage. So please help me with this. I will give you a credit in my game.. http://behrozkhan.wixsite.com/ex... Exellar game designing studio |
||||
|
okay! here is the implementation of the code... you can change the code as per your requirements... try pressing spacebar for a jump and when the player reaches ground it will take damage by -10 and if you do a double jump the damage will be higher...and so on... here is the link to download the ccb file:- https://drive.google.com/file/d/... |
||||
|
@JIC - NICE! You are much appreciated. Mike |
||||
|
I implemented this in my project by drawing 3 lines from the player to the ground and calculated how long these lines were above the land. Here's the code from my project (Sorry it's a bit sloppy, I'm not a great programmer, I write this in a way I would best understand, If you have any questions, you can send me a message on facebook www.facebook.com/deltaxgames). var __deltaTime=0; var __lastTime=0; var isFirstCount=true; function getDeltaTime() { var now=(new Date()).getTime(); if (isFirstCount) { __deltaTime=0; isFirstCount=false; } else { __deltaTime=now-__lastTime; } __lastTime=now; } ccbRegisterOnFrameEvent(getDeltaTime); var player=ccbGetSceneNodeFromName("Player scene node name"); var playerHeight=18; //the height of the player var canClimbLadder=false; var isFalling=true; var inAir=true; var airTime=0; var isFirstFall=true; function gameLoop() { //check if player is falling var playerPos3D=ccbGetSceneNodeProperty(player, "Position"); var playerBottomYPos=playerPos3D.y-playerHeight; var startPos3D = playerPos3D; if (ccbGetCollisionPointOfWorldWithLine(startPos3D.x, startPos3D.y, startPos3D.z, startPos3D.x, playerBottomYPos, startPos3D.z)||ccbGetCollisionPointOfWorldWithLine(startPos3D.x, startPos3D.y, startPos3D.z, startPos3D.x+20, playerBottomYPos, startPos3D.z)||ccbGetCollisionPointOfWorldWithLine(startPos3D.x, startPos3D.y, startPos3D.z, startPos3D.x-20, playerBottomYPos, startPos3D.z)||ccbGetCollisionPointOfWorldWithLine(startPos3D.x, startPos3D.y, startPos3D.z, startPos3D.x, playerBottomYPos, startPos3D.z+20)||ccbGetCollisionPointOfWorldWithLine(startPos3D.x, startPos3D.y, startPos3D.z, startPos3D.x, playerBottomYPos, startPos3D.z-20)) { isFalling=false; inAir=false; } else { isFalling=true; inAir=true; } //calculate AirTime if (inAir) { airTime+=__deltaTime; } else { if (airTime>0) print("Last Air Time: "+(airTime/1000)+" Seconds"); //damage player if he falls from a high place (falls for more than 800 miliseconds) if (airTime>=800) { var name=ccbGetSceneNodeProperty(player, "Name"); currentHealth=ccbGetCopperCubeVariable(""+name+".health"); ccbSetCopperCubeVariable(""+name+".health",currentHealth-(airTime/40)); } airTime=0; } } ccbRegisterOnFrameEvent(gameLoop); |
||||
|
Ooh and yeah you must put this in an Execute Javascript action. And add that action to a on First drawing do something behavior in the root scene node. |
|