Basically what I want to make is an extension for all those single-line functions that are only accessible in javaScript. This is going to be a running project that I’ll update over time, as I discover javaScript exclusive features. If you find a function in javaScript you would like added, just post it here or create a pull request on the GitHub page. If you do it correctly, with a small description attached to your blocks implementation and everything, making a pull request will be much faster then posting here.
So far I have:
some image manipulation blocks and the blocks from that image scale extension I made
blocks for changing the font/background/border colors of Info hud elements
and one for changing the “lives” image
blocks for getting/setting the screen brightness
system menu stuff like opening it and closing it, trying to add blocks for making menu items right now
a block to check if a sprite has a certain Flag enabled (think “bounce on walls” and “invisible” flags)
that little color picker insert that I stole from @UnsignedArduino’s ColorBlock extension
Things I am not planning to add yet, but may be added in the future:
Everything Buffers
Music stuff
Stuff that well known extensions already add, like the Settings extension and the Colors extension
Things that I cannot physically add in an extension but know people will ask for
Screen size changing
More than 16 colors
If you ask for something, I will like () your post if I think I can add your idea!
I’ve added the print blocks, as well as some basic Buffer blocks! I also added array.slice and array.copy because I needed them for a blocks project I was working on.
Blocks aren’t bits of code you are adding into your game, they are functions being called by blocks, and the inputs to the function is what you put the block. When you use the JavaScript code to change the screen size, you are overriding those constant variables, which you can’t do inside a function because you are basically re-defining a constant, so we can’t turn them into blocks.
Ummm @Reflectfr can you explain what you mean by that??
You could also just make a sprite with an empty image. If you turn on that “ghost” option, or “ghost through walls” then the sprite will be able to go through walls just like the camera.
Added blocks for using the music.playInstructions and music.addNote functions! Also a small block for finding the volume set by the user in the system menu, which you need because the playInstructions function bypasses the system volume.
I also added the setPalette block. 16 colors, one byte per color channel (rgb) so the input buffer should be 48 bytes long.
Maximum volume is 1024. Idk if there is a maximum hz, but there is a point at which us humans can no longer physically hear the sound, so that’s probably the limit.
Each sound instruction takes up 12 bytes of the buffer.
These are all the possible instruments:
1 - triangle
2 - sawtooth
3 - sine
4 - pseudorandom square wave noise (tunable)
5 - white noise (ignores frequency)
11 - square 10%
12 - square 20%
…
15 - square 50%
16 - filtered square wave, cycle length 16
17 - filtered square wave, cycle length 32
18 - filtered square wave, cycle length 64
The real reason to use JavaScript is that makecode won’t randomly delete stuff.
If people wanted to learn JavaScript, they would do it. This extension shows people that there are way more features in JavaScript than in blocks, more than I could possibly find and add by myself. If I could add things like namespaces and classes in blocks, I would, because I think everyone should be able to use such features without having to use written code.