On the website Microsoft® Makecode (BBC Micro:bit), if you create a project, go to javascript, ctrl (or cmd for mac) c and ctrl v this:
let x = 0
let y = 0
function toggle_x_row (row: number) {
led.toggle(0, row)
led.toggle(1, row)
led.toggle(2, row)
led.toggle(3, row)
led.toggle(4, row)
}
function toggle_screen () {
toggle_y_row(0)
toggle_y_row(1)
toggle_y_row(2)
toggle_y_row(3)
toggle_y_row(4)
}
function toggle_y_row (row: number) {
led.toggle(row, 0)
led.toggle(row, 1)
led.toggle(row, 2)
led.toggle(row, 3)
led.toggle(row, 4)
}
function _2_row_toggle_XY (X: number, Y: number) {
toggle_x_row(Y)
toggle_y_row(X)
}
input.onButtonPressed(Button.A, function () {
x += 1
})
input.onButtonPressed(Button.B, function () {
y += 1
})
input.onPinPressed(TouchPin.P0, function () {
x = 0
y = 0
})
input.onPinPressed(TouchPin.P1, function () {
_2_row_toggle_XY(x, y)
})
and press play, you can play this game I spent a lot of time making.
it's called hard paint.
if you already have a Microbit, it's your lucky day! just upload the code to your BBC Micro:bit and follow the hardware instructions. Otherwise, follow the software instructions
the instructions are on the next page.