![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | BlockOG |
I want to make an “Action RPG” game and I want the damage on the player to be 1 but there to be a 25% chance for it being 2
![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | BlockOG |
I want to make an “Action RPG” game and I want the damage on the player to be 1 but there to be a 25% chance for it being 2
![]() |
Reply From: | Zylann |
So you want damage to be 1 in 75% cases, and 2 in 25% cases?
This would work:
if randf() < 0.75:
damage = 1
else:
damage = 2
what does randf() do? Could you link the documentation to it?
Millard | 2020-05-28 20:28
It generates a decimal number between 0 and 1
@GDScript — Godot Engine (stable) documentation in English
Zylann | 2020-05-28 20:41