how to make a bullets damage scale with a % from the player?

Get help using Construct 2

Post » Tue Aug 08, 2017 7:02 pm

I'm trying to make a bullet use a % for damage that scales up or down. If that makes sense?

Something like this..

Base Damage * % = Damage of bullet to the targets health.

So..

10 * 50% = Bullet does 5 damage.

I'm not sure how to start this. How do I make the bullet use a % and use the base damage the player currently has to make the total damage?
B
9
S
1
G
2
Posts: 7
Reputation: 1,445

Post » Tue Aug 08, 2017 8:03 pm

Give the bullet an instance variable 'damage'.
When firing the bullet give 'damage' the value BaseDamage * (pct / 100)
You need some logic to give a value to 'pct' (%)
When the bullet hits, calculate damage based on 'damage'
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Aug 08, 2017 10:46 pm

It works! Thanks for helping! (love ya) :3
B
9
S
1
G
2
Posts: 7
Reputation: 1,445


Return to How do I....?

Who is online

Users browsing this forum: ounound and 19 guests