Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //method to work out damage from blocks?
- CollidedWith(Entity theOtherEntity){
- float towardsAccuracy = 0.5f;
- float damage = 0f;
- if(theOtherEntity instanceof Actor
- && body.getPosition().add(((Actor)theOtherEntity).body.getPosition().sub(body.getPosition).dst(body.getPosition().add(body.getLinearVelocity()) < towardsAccuracy){
- damage = body.getLinearVelocity().length() * body.getMass();
- damage = Math.sqrt(damage); //not sure if this is needed to scale down the damage from being stupidly high?
- ((Actor)theOtherEntity).takeDamage(damage,this);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement