Likewise to Scratch, i’d like to be able to run a method without refreshing the screen (this can be useful for cases such as raycasting), and I have a clue on how to do it. I know the Arcade sprite util extension has a block for running events before / after a certain action taken by the game engine but I don’t know which of these would correspond to the feature I’m looking for. (Speaking of, I could be on the completely wrong trail here, looking at the wrong way to achieve this.) @jwunderl?
Thanks in advance
By default, run without screen refresh makes loops In functions run the whole loop in 1 frame instead of waiting until the next frame to loop again. This is performed by default if no pauses are included in loops. There’s also the do separately which runs processes on a separate thread, from the timers extension in the recommended extensions. Are you trying to do something mid-frame (Like detect custom collision per pixel instead of only on game update)? I’ve done this on kiwiphoenix364/pxt-mini-tilemaps - using a method that every frame finds the distance moved mid-frame and changing the position each frame by distance moved / times looped (or something similar to that) moved looping by distance moved on the X and y axis - it’s a bit of a hack but it worked for me (it is slow though). For other tasks that require mid-frame updates, similar hacks can be done but sadly they’re usually slow sadly. I hope this is helpful for what you’re trying to do, but if you are trying to do something else, please tell me!
Hmm, does that mean putting a while loop into a do seperately block will multi-thread it, meaning it won’t freeze the whole program?
Yep! I use do separately all the time to run timed events without stopping my code!
No (it’s more asynchronous then multithreaded you still need to “yield” and in Arcade’s case, that is
I am interested in this, can you describe it more detail?
Technically, if you want to run without a screen refresh just don’t call
pause or functions that call
pause themselves or update the screen. This is easier said than done since it’s difficult to figure out which blocks do and don’t call a screen refresh, although I believe most don’t.
Raycasting typically just ends up writing to a buffer/image anyways, so I don’t see any change it would provide. I also can’t think of any other useful things that would benefit from such. (in Scratch, for example, it is more useful since the API is much more limited, but Arcade is much more flexible)
Yeah, I am in process of working on a raycaster. My original idea was to shoot out rays in the form of sprites and for that I wanted to make sure they appeared next to the wall instantly. I ended up scrapping that idea since it was too slow, so now I use a method of calculating coordinates and storing them in arrays for efficiency.