![]() ![]() # While there are less than 5 enemies, we cycle through each coin and determine the closest one. Need help with a CodeCombat Python level This video shows you step-by-step how to beat this level from the Python Computer Science 2 course in CodeCombat. A parameter is a variable containing the information passed in from a function. Also, when he picks up all of the items in the first grove, he just stands there and waits, he doesn’t move to (28, 28) like he should. An argument is the information included between the () when any given function is called. Learn Python or JavaScript as you defeat ogres, solve mazes, and level up. As you will see in this level you need to patrol moving from X to X. ![]() The isPathClear suddenly started to work now, but now my code runs through and works but keeps giving me an error saying “pos” on line 7 is undefined. Learn programming with a multiplayer live coding strategy game for beginners. Franz March 4, 2019, 2:11pm 1 Hello I’m still a beginner in Code Combat so maybe one of you more experienced users could point me in the right direction. ![]() I had to state the variables “coin”, “pos”, “x”, and “y” at the beginning of the loop, because if they were only stated in my ‘while-loop’ then they would come up as null sometimes and break my code. # While there are less than 5 enemies, we cycle through each coin and determine the closest one. If you want to build a fire-trap where the flag is, though, you need x- and y-coordinates for the buildXY method. But I get an error for if self.isPathClear(self.pos, pos) as “isPathClear is not defined”. So if there is not a clear path, I make my character walk into the next grove. Our mission is to engage all students, regardless of coding experience, and help them discover a pathway to success in Computer Science. I needed to add the condition that we only walk to our desired coin if there was a clear path, because otherwise I pick up all the coins in my area and then walk into the wall. CodeCombat is recommended for districts, schools, clubs, and programs with students aged 9 and older. I wrote the code and added comments to make it clearer. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |