So like in microStudio making a button click show a sprite somewhere else is simple You only need to do two things: check if the mouse is inside the button when clicked and flip a "switch" variable from 0 to 1 to tell the game to start drawing your sprite.
Because microStudio draws boxes right from the middle, finding the edges just means taking your center position and moving back or forward by half the width/height.
Heres something you can read and copypaste
init = function()
// Button position and size
button_x = 0
button_y = 0
button_w = 100
button_h = 40
// Where the sprite will pop up
sprite_x = 0
sprite_y = 60
// switch: 0 means hidden 1 means visible
show_sprite = 0
end
update = function()
// Did they click or tap the screen?
if mouse.press or touch.press then
// is the mouse inside the buttons 4 edges?
if mouse.x > (button_x - button_w/2) and mouse.x < (button_x + button_w/2) and
mouse.y > (button_y - button_h/2) and mouse.y < (button_y + button_h/2) then
// This flips the switch on if its off, or off if its on
if show_sprite == 0 then
show_sprite = 1
else
show_sprite = 0
end
// Clear the press so it doesnt double trigger
mouse.press = 0
touch.press = 0
end
end
end
draw = function()
screen.clear("#111522")
// Draw the button box and text
screen.fillRect(button_x, button_y, button_w, button_h, "#00f3ff")
screen.drawText("CLICK ME", button_x, button_y, 14, "#000000")
// If the switch is ON, draw the sprite
if show_sprite == 1 then
// Just change "cube1" to whatever your sprite is named
screen.drawSprite("cube1", sprite_x, sprite_y, 30, 30)
end
end
(Sorry about the code format breaking idk why that happens)