Can i use sprites in a list?

I don't understand. Since a "bank" is a list of sprites, why do you need another list? Just make a longer one. Or do you want the other bank to take a different action?

like for example if I were to press a different number to get a different result

Oh yeah sure. I was thinking you'd just add the list for 1 first, then the list for 2, etc., but you could use arbitrary keys this way:



The ASSOC block is in the list utilities library (second one in the menu).

P.S. If you wait a moment I'm sure some kid will tell you how to make a "last key pressed" block and then you can just use

Oops I goofed, I meant


...

OK.(but it's sure to need JS D~:)

window.press=0;
document.onkeydown=function(e){
window.press=e.key;
}
return ()=>press;

that doesn't work,

. the working one is in my Cool custom blocks! project.

Why does it return a function?

(I know I'm mentioning I'm a js dev)
As a js game dev, I always advise to store your sprites (or at least clones) in lists, when non-block programming.
This is an concept that has been used for almost every game, so it should be possible

you don't have to use js


Call that.

But why can't you just use return press;?

That's ok too

Then why did you use the other method?

You dont need to create a new variable and a new function

I deleted my post why did you reply to it
besides you also reinitialized the variable in your code
Edit: ohh wait, i see how you could use that. but personally I just prefer to use an if statement in the js

Project script pic (1)

My code string looks like this, is there any reason this would be incorrect? It isn't really working past the glide function

I'd have to see the rest of the code, e.g., where you made the sprite list. Can you share the project and post a link? Thanks.

oh the rest is just eight sprite lists with their respective sprites

You should replace the reporter in the first script with

, because just using it in a boolean input will not register the 0 key. 0 is counted as false, and the empty text string is (I think) counted as true. (Edit: Apparently it isn't nevermind)

Still, I'd like to be able to run the project to debug it!