Falling Damage





Someone make this not look so bad. please.
Original Source
 

levalencia

Senior Member

http://game-engine.visual3d.net/forum/images/ranks/militarybars/rank_8.gif

 
levalencia's Avatar

 

Join Date: Oct 2008

Posts: 268

Defaultdie according to the height of the jump?



If I make 3 different buildings, with 3 different heights.

I want the player to die if he jumps from the biggest building.

Can I accomplish this easily with beta 3? how? just programming the api, there will be a method or something that says

getHeight()

if(getHeight() > 10 )

Player.Die();

I would love it http://game-engine.visual3d.net/forum/images/smilies/smile.gif

Old10-22-2008, 04:37 AM

  #2

najak

Realmware CTO

http://game-engine.visual3d.net/forum/images/ranks/militarybars/rank_14.gif

 

Join Date: Feb 2008

Posts: 1,485

Default



I'd recommend you just use SimpleDynamics for now, which employs gravity and scene Heightmap. Whenever an object "lands" on the ground from a fall, it calls the object's "OnLanded" event handler, where you can check the velocity of the impact. So I'd recommend that you just deliver damage to the avatar as a function of the "Y" velocity (downward) upon landing. Then if the avatar runs out of health, they die (already implemented).

Old10-22-2008, 05:01 AM

  #3

levalencia

Senior Member

http://game-engine.visual3d.net/forum/images/ranks/militarybars/rank_8.gif

 
levalencia's Avatar

 

Join Date: Oct 2008

Posts: 268

Default



nice, I will love it!

when I click on an avatar and then click on events, I dont see any events, I guess its available on 3.0 only?

thx



Last edited by levalencia : 10-22-2008 at 05:04 AM.

Old10-22-2008, 07:08 AM

  #4

najak

Realmware CTO

http://game-engine.visual3d.net/forum/images/ranks/militarybars/rank_14.gif

 

Join Date: Feb 2008

Posts: 1,485

Default



The OnLanded handler is a virtual method that gets called by Simple Dynamics, and so there isn't an event to register for, but rather just a method to write. In Beta 3.0, these hard-coded methods will be replaced more flexible events.

Old10-22-2008, 09:04 PM

  #5

levalencia

Senior Member

http://game-engine.visual3d.net/forum/images/ranks/militarybars/rank_8.gif

 
levalencia's Avatar

 

Join Date: Oct 2008

Posts: 268

Default



Najak.

I guess I create the method on the script editor, Does it have intellisense?

well, lets suppose I created the method something like

public void DecreaseHealth(Player p, Vector2 velocity)
{
if(velocity > ANumber)
{
p.Health=0;
p.PlayAnimation("die");
}
}

now how do I execute this method on the Onlanded event?



Last edited by levalencia : 10-22-2008 at 09:07 PM.

   
           

 


 
 
 
 
 
 

Old10-22-2008, 09:20 PM

  #6

najak

Realmware CTO

http://game-engine.visual3d.net/forum/images/ranks/militarybars/rank_14.gif

 

Join Date: Feb 2008

Posts: 1,485

Default



For Beta 2.4 you can either define an "OnLanded" command/activity for the avatar, or you can just override the "OnLanded(..)" method in the Avatar class, and call your code from there. So right now, it *does* act as both a hard-coded override as well as an event called "OnLanded".

       

 

Can not see it...

The webpage's format is kind of mess.

I have added summary of this

I have added summary of this response under the new Gameplay Programming FAQ page, and will delete this page.


love