Damage Rounding

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
guo
Metal Slime
Posts: 749
Joined: Fri Dec 04, 2009 9:12 pm

Damage Rounding

Post by guo »

Hey,

Is damage rounded up or down? Let's say a basic attack (atk-(0.5*def)) with an attack of 2 and a def of 1.. would normally be 1.5 damage. Does it round to 1 ?

Regards.
vvight.wordpress.com
TMC
Metal King Slime
Posts: 4310
Joined: Sun Apr 10, 2011 9:19 am

Re: Damage Rounding

Post by TMC »

Damage is rounded to the nearest integer. When exactly halfway between integers (x.5), it's rounded to the nearest even integer (this the default in FreeBASIC; I don't know how QuickBasic OHR versions worked). So 1.5 damage becomes 2, while 2.5 becomes 2.
User avatar
guo
Metal Slime
Posts: 749
Joined: Fri Dec 04, 2009 9:12 pm

Re: Damage Rounding

Post by guo »

Thanks TMC.
vvight.wordpress.com
Post Reply