I’m compiling a list of the most common errors that people run into when first starting out with MakeCode Arcade. So far, I have: using a variable before you declare it, figuring out the overlaps block (Sprite kinds, using local variables), not destroying a sprite on overlap. Any other ‘gotchas’ you can think of when you first started coding with Arcade?
Awesome project! One I had was learning to use the ‘Move sprite with buttons’ block instead of setting out a bunch of ‘On up pressed’ ‘On down pressed’ ‘On left pressed’ ‘On right pressed’ blocks!
Coding every enemy one by one instead of using sprite type blocks.
“Couldn’t read properties of null”
Using sprite data extension for sprite specific values
Using for element value for array of sprites of kind to get all sprites of the same kind
Setting player movement to 0 to stop controls
Using debug mode to check if code is running/check on the variables
Character animations instead of running them “on button pressed”
Setting UI to be relative to camera so it follows the player
Hopefully this is helpful to someone!
If you’re looking for block errors, it’s list index is out of range.
The most frustrating JS error for me as a beginner was the infamous
'Element implicitly has an any type because type has no index signature'
These are so great! Thank you all! Hopefully this list will help people who are just starting out…
From a classroom setting, 4 errors seem to occur repeatedly:
- Two functions with identical names
- Comparing strings case sensitively
- Parameters suddenly defined as new variables with the same name inside the function(don’t know how)
- All blocks suddenly disappearing from the canvas and undo not working(have not figured out how this happens)
And of course indexing errors…
Oooh! Good ones! For #4, we are working on a versioning feature that will hopefully mitigate losing code.
That would be a suberb enhancement!
Personally, I believe I mostly have experienced this when switching from text based code to blocks, especially if some error occurs during text based view or having switched between Python and JS. Not sure what the affected students are doing prior to losses in class, but I have seen and experienced it - and read about it here - enough to frequently download PNGs just to be sure…
That sounds great! Finally, the days of losing the code you worked so hard for are over!
I’ve had some fun with the error “e.findIdx is not a function” also, when trying to mix text and numbers in two-dimensional arrays…