Ok so i’ve been playing code combat and i’ve been stuck on this level for a while now. May I have some help please?
This is what i have so far!
# Put flags where you want to build traps.
# When you're not building traps, pick up coins!
loop:
flag = self.findFlag()
if flag:
# How do we get fx and fy from the flag's pos?
flagpos = flag.pos
fx = flag.pos.x
fy = flag.pos.y
self.buildXY("fire-trap", fx, fy)
self.pickUpFlag(flag)
else:
item = self.findNearestItem()
if item:
pos = item.pos
itemX = pos.x
itemY = pos.y
self.moveXY(itemX, itemY)
Weird, because when I press submit and place a flag my character just freezes in place, does nothing and doesn’t collect coins at all. Also, after the submit play time is over i get a notification (In game) saying
" Line 11 : undefined is not a function (evaluating ‘tmp1temp22, _aether.restoreAPIClone(_aether, tmp24), _aether.restoreAPIClone(_aether, tmp25))’) "
This appears in the Red Box that says something is wrong with your code, it is also flashing the self.buildXY(“fire-trap”, fx, fy) code line.
Ok, so i tried on firefox, says "Uh oh! your browser is to old to run this software."
I’ve tried all my computers and it does the same thing every time. only browser that i have that works for code combat is Safari on my Mac Book Pro.
Didn’t do anything, tbh it just changed the name of the item. The original was fine i’m just getting a error when i place the flag it just freezes my character and gives me a error message "
if flag:
# How do we get fx and fy from the flag's pos?
# (Look below at how to get x and y from items.)
self.buildXY("fire-trap", 30, 45)
self.buildXY("fire-trap", 30, 31)
self.buildXY("fire-trap", 30, 16)
else:
item = self.findNearestItem()
if item:
itemPos = item.pos
itemX = itemPos.x
itemY = itemPos.y
self.moveXY(itemX, itemY)```
Well, for starters you did not do what the instructions told you…
"(Look below at how to get x and y from items.)"
“Seconders”, you are building 3 firetraps for every flag placed.
Change the code so that you build the fire-trap where the flag is, using the template for “item” (iow: try copying the item code and replacing “item” with “flag”…)
and for “thirders” (snicker at self) learn how to use ``` to format your code so we can see if your indenting is correct.
```
code
```
comes out
code
(and yes I put four spaces in front of both "code"s)