c# - check if progressbar is filled -
i'm making pvp simulator in c# , have ran problem progressbars. im trying is: when 1 of players attacks, random number gets added progressbar. once full radiobutton gets enabled , allows player special move. here code:
random r = new random(); int minvalue = 1; int maxvalue = 20; int special = r.next(minvalue, maxvalue); attack.hitplayer2(); int result = (specialbar1.value + special); if (result < 100) { specialbar1.value = (specialbar1.value + special); } else if (result == 100) { specialbar1.enabled = true; } else if (result > 100) { specialbar1.value = 100; }
for reason if result == 100 doesn't work. know how fix this?
if result == 100 doesn't work
because result either more or less 100. make checks first. actually, should have 1 check >= 100 instead of 2 separate checks. want same anyway.
random r = new random(); int minvalue = 1; int maxvalue = 20; int special = r.next(minvalue, maxvalue); attack.hitplayer2(); int result = (specialbar1.value + special); if (result < specialbar1.maximum) { specialbar1.value = (specialbar1.value + special); } else { specialbar1.enabled = true; specialbar1.value = specialbar1.maximum; }
Comments
Post a Comment