Help MEEEEEEEEE! :|

https://makecode.com/_1aa3zDXHWCsYhttps://makecode.com/_1aa3zDXHWCsY
Um, I can’t draw lines.

@richard do you know what’s going on???

What’s happening here has to do with the arcade game loop!

Every frame of a game written in arcade goes through a bunch of steps in the same order. There are a lot of different things that go on (you can see all of them here), but the relevant ones in this case are these two:

Step 1 Controller events are run (the very first thing that happens each frame)

Step 8 The screen is rendered (all sprites, tilemaps, background images, background color, etc. are drawn the the screen)

Because the screen is rendered after controller events are run, anything that is done to the screen inside a controller event will be overwritten by step 8.

So how can you draw directly to the screen? Use the excellent jwunderl/arcade-sprite-util extension that @jwunderl made! Inside that extension there is a block that lets you draw to the screen at a specific z-index:

Screen Shot 2022-05-03 at 11.05.25 AM

Try putting your drawing code in there!

Thank you!!!

2 Likes