Making an extension for every JavaScript exclusive feature I can think of!

I made that a looong time ago, using number arrays to store image data was the best I could come up with then. So it’s not out of the question that the method for storing images could be improved and optimized

2 Likes

Richard explained on stream that the ofBuffer function is a very complicated function that is used to store images such that they are page aligned in memory, making them faster. I do not think I’ll add it to this extension. Eventually, if you are using advanced functions like that. you should just switch to JavaScript.

4 Likes

wait so ofbuffer can store a image into say “medhsnxhnx” something like this or "myimage’

No. I wrote wrong. ofBuffer is only for decoding. There is no exposed function for encoding. You have to copy that part from somewhere else (watch stream to figure that out I guess)

4 Likes

Ok someone in stream chat today said I should add the sprite follow block with the extra option for turn rate that exists in JavaScript, so I have added that. I have also added the Parse Int and To String blocks that @AlexK suggested. I… think they work.

4 Likes

ooh the one with acceleration

1 Like

The variable name is called “turnRate” internally so I would assume it’s that.

1 Like

huh i always called it acceleration because thats what it does

1 Like

Don’t know why I didn’t think of this before, WoofWoof, but there are all of the “set” operations that can be applied to arrays. If you want an extra challenge. :smiley:

myArray.concat()
myArray.splice()
myArray.join()
myArray.some()
myArray.every()
myArray.sort()
myArray.map()
myArray.filter()
myArray.find() // Not the same as myArray.indexOf()
myArray.reduce()
myArray.fill()
2 Likes

Try doing this: screen.fillCircle(80, 60, 20, 5)

It’s a feature I recently found that’s not avalable in blocks.

1 Like

Another random one that I’ve seen lately: A block that lets you programmatically turn stats on and off.

2 Likes

import SargeDev/better-arrays
Ok done!

Edit: thanks for the like :melting_face:

5 Likes

I feel like I already have that in there but I’ll look.

2 Likes

I thought you did, too, but I didn’t see it as I scanned your code. Quick scan, I’ll admit. :smiley:

1 Like

If you haven’t you should implement sprite.id into the extension

2 Likes

yeah actually there have been several times on stream where i’ve wanted that… it’s actually pretty useful.

the sprite id is unique to each sprite and they always ascend in order created, so you can use it to determine if one sprite is older than another.

it’s also nifty because sometimes you want to do something for a pair of sprites each frame but you don’t want to accidentally do the work twice (e.g. if you’re looping over a list of all sprites). the id makes it easy because you can code your check to only run if sprite A’s id is higher than sprite B’s

5 Likes

COMING SOON TO EXTENSIONS NEAR YOU:

8 Likes

Hey @WoofWoof , for block users, maybe you should make another for loop so you can actually decide whether it does -= or +=?

Also, suggestion, maybe you could move the bit operators and stuff into either //% advanced or a subcategory?

2 Likes

Going through this list slowly implementing and most of these I’ve never used before. .some and .every I would just write a For Of loop for, but how on earth did I forget about .sort and .concat!

I bet using those functions instead of a For loop is probably faster… hmmmmmm…

2 Likes

All of those functions are for compatibility with the backing JavaScript type. Array.prototype.some() and Array.prototype.every() are kinda niche functions, I agree.

1 Like