So, I am trying to make it so that when I click on a sprite (text sprite), a pop-up menu will show up. (This is for making an update notes message)… I have tried many methods, but I am curious if anyone knows how to accomplish this.
Welcome to the Makecode forum @DAJurewicz!
Here is some code for detecting if the mouse is clicking a text sprite! It will work for any sprite, but for the demo I used a text sprite:
The “right click” code works only if you aren’t moving the camera around, or if the sprite is “relative to camera”.
The “left click” code works no matter where you move the camera, but it’s slightly more complicated, and it doesn’t work if your sprite is “relative to camera” (if it’s ‘relative’, it would still work if the camera was where it starts, but not if the camera has been moved)
If you make your own copy of this demo, you should be able to copy/paste code from the copy straight into your game, which is a very new Makecode feature!
Hey, thanks! I really appreciate the help and the welcome! Random question for you. In the same project, I have a button function and I also have the button combos extension. Down below in the section labeled “button functions” in this project, do you know why my basic A and B functions are not working when I press them after using the A+B combo? I’ve been trying to fix this problem that arised for like a week haha. Sorry I keep giving you more problems and issues lol.
I’m mostly on this forum to help, so ask away!
I… can’t seem to find the issue you are describing? After pressing A and B to activate that map thingy, I can still use both A and B functions, until of course I run out of “uses” that is. Could it be something where your keys are bugging and pressing the buttons multiple times rapidly when you use a+b, making you run out of uses really fast without you noticing? That is the only thing I can think of. Maybe try making the monkey “say” the “a uses” variable, so that you know what number it’s at while you play. Also make sure to keep in mind the number of uses required to activate the effect, for example level 1 requires the “a uses” number to be 2 or lower to activate the effect!
Also keep in mind that using the a+b combo uses up a normal A and B function, so maybe you have to code something to prevent that or give the player those wasted uses back?