Hello peeps, I’m new to makecode and coding in general especially in javascript. I decided to use the github thing that I saw on other forums because I wasn’t a huge fan of the UI for sprites on makecode (used piskel if that matters- Pretty good sprite maker btw), and copied the code into java, but it keeps saying there’s a problem and that it can’t convert my code.
Sorry this is kinda rambling and probably very easy fix that went above my head…
Either way, would apreciate any help!
I am not 100% about this one. But it seems like some of the numbers are referencing to a color that is -1. In makecode there is no such color. There’s only 1-16 including transparency. So I would guess that is causing the issue. But I don’t know how to fix it though.
- Welcome to makecode forums,
- I think your problem might be that like what @Sonicblaston said that -1 is to a color my suggestion is change all of your assets after copying all of those numbers by selecting it all and copying it and paste it in something like notes to save it. And then if that doesn’t work switch it to blocks and try switching the colors or maybe get a tool that drag over your sprite when in sprite editor and copy that sprite then make a sprite in javascript and insert that image.
Hope that helps.
Though the -1 color is weird, the error is referring to the fact that you are missing the other “ ` ” at the end of the image file. This is a weird character and it might not be on your keyboard, so I would just copy and paste the character. It’s the one right after “img” and it looks like the “ ‘ “ character but it’s actually a different one.
The -1s will also cause an error: “ invalid character in image literal: ‘null’ ”. I don’t know how this could have happened unless you used a search and replace command, as unless there is a glitch in the image editor, it should never result in -1s in the image. Simply deleting all the “ - ”s in the image should fix the issue, but “ 1 ” is usually the color white, so if -1 was supposed to be a different color you should be able to edit the image again to fix it. If editing the image results in more “ -1 ”s then you should probably let @richard or @makecode about the bug.
Oh wait nevermind about the Makecode image editor bug, I forgot about the copying from paskel! I suspect that paskel might use -1 for transparency or something. Makecode uses color 0 for that, so after you get rid of the “-1”s you will probably have to redo all the colors, which is annoying.
Oh, I just had a closer look try using a bracket to close the line
Oh yea, I figured out the problem a lil while ago, it was copying piskels palette, instead of just copying the code to java