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
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.
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)
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.
ooh the one with acceleration
The variable name is called “turnRate” internally so I would assume it’s that.
huh i always called it acceleration because thats what it does
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. ![]()
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()
Try doing this: screen.fillCircle(80, 60, 20, 5)
It’s a feature I recently found that’s not avalable in blocks.
Another random one that I’ve seen lately: A block that lets you programmatically turn stats on and off.
import SargeDev/better-arrays
Ok done!
Edit: thanks for the like ![]()
I feel like I already have that in there but I’ll look.
I thought you did, too, but I didn’t see it as I scanned your code. Quick scan, I’ll admit. ![]()
If you haven’t you should implement sprite.id into the extension
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
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?
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…
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.
