Description: The "if" keyword is followed by a condition comprised of comparison operators such as ==, &&, ||, and !. If the condition is true, then the statements after the if up until the matching "end" are executed. Otherwise, they're skipped.
Code Sample:
def random_target_enemy(hp0 = false)
roulette = []
for enemy in @enemies
if (not hp0 and enemy.exist?) or (hp0 and enemy.hp0?)
roulette.push(enemy)
end
end
if roulette.size == 0
return nil
end
return roulette[rand(roulette.size)]
end
RPG RPG Revolution is your #1 stop for game development and console RPG games, as well as those created by people like you. Link to us to support us, so we may grow to be better website community for you.