why can`t I use flags in any level???
I found this glich in apcolipse world 2
and also I useley chaet with yetis,robombs,skeleins and burl
My code is here:
while True:
flag = hero.findFlag()
if (flag):
if hero.distanceTo(flag) > 10 and hero.isReady(ājumpā):
hero.jumpTo(flag.pos)
else:
hero.pickUpFlag(flag)
my hero is not reacting
@Daniel_Stotskyy please format your code correctly using the </>
button when writing your post. Then we can help you.
Thanks!
while True:
flag = hero.findFlag()
if (flag):
if hero.distanceTo(flag) > 10 and hero.isReady('jump'):
hero.jumpTo(flag.pos)
else:
hero.pickUpFlag(flag)
I honestly have no idea if this will help, but try taking the parentheses off (the ones surrounding āflagā after the āifā) does that make any sense?
Yes, as @enPointe77 said in Python you donāt use parentheses in an if
statement.
Are you sure?!
if ( 5 > 3):
print ("5 > 3")
console:
I cannot help you more, never used flags, finished Apocalypse without flags when i had two years CoCo experienceā¦
Iām quite sure this wonāt work, jumpTo method requires smth like ({āxā: flag.pos.x, āyā: flag.pos.y}) as far as I remember.
Passed codecombat.com/play/level/rich-forager? with
while True:
flag = hero.findFlag()
if (flag):
if hero.distanceTo(flag) > 10 and hero.isReady("jump"):
hero.jumpTo(flag.pos)
else:
hero.pickUpFlag(flag)
I think the code is OK
Yep, I was wrong, flag.pos works for jumping. And the code is ok.
maybe a flag bug.
man, I was thinking only JS does if
with parenthesesā¦