Why can't I pass this level with the above code? What should I do?

while True:
item = hero.findNearestItem() # Tìm món đồ gần nhất
if item:
# Lưu vị trí của món đồ vào các biến x và y
itemposx = item.pos.x
itemposy = item.pos.y
hero.moveXY(itemposx,itemposy) # Di chuyển đến vị trí món đồ
pass

White Rabbit

1 Like

Hello and welcome to the codecombat discourse, @Ph_m_Th_Ng_c_L! If you haven’t already, please read the rules here: Welcome to CodeCombat Discourse Forums!

When I tested your code with proper formatting it worked for me
You can format your code with this button:


if you do have the proper formatting can you send a screenshot of your hero’s gear?


"My character just stands there and doesn’t move to the item when I run the code. What should I do

unfortunately I think your hero is too slow for this level
some of the levels don’t work if you use subscription heroes, especially Okar, without using the Speed Ring.
If you switch to a faster hero or equip the Speed Ring it should work

1 Like

Try using amara arrowhead she has decent speed and she is free

1 Like