Files
first-step/leek wars.js
2025-09-29 17:05:08 +02:00

17 lines
356 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// On prend le pistolet (coûte 1 PT)
setWeapon(WEAPON_PISTOL)
// On récupère l'ennemi le plus proche
var enemy = getNearestEnemy()
// Si jai trouvé un ennemi
if (enemy != null) {
// Si je peux tirer sur lui
if (canUseWeapon(enemy)) {
useWeapon(enemy)
} else {
// Sinon je me rapproche
moveToward(enemy)
}
}