I am trying to make a mario like game, and am trying to put in coin count at the top right and lifes at the top left. However, to put in a coin count at the top right, I have to have it relative to the camera. Any suggestions?
Also, is there any way to condense my "On (sprite) of type (player) overlaps (othersprite) of type (player) blocks? I have a bunch of them with the same function, and they take up a lot of my space and make it hard to find things.
Sprite utils extention, get the extention and find the set life image brick,
What’s the problem with having it relative to the camera? There is a flag for doing that. I believe it’s in the same dropdown menu as the “ghost” flag. There are also extensions that let you change the images of the built in “life” and “score” counters in the Info blocks tab. The one that comes to mind is my own extension, woofwoofcodes/pxt-javascript-extras
but that adds a lot of other stuff that you don’t need.
when I tried to make it relative to camera, it just put it on the right side halfway up and I couldn’t change it’s Y. I’ll take a look at your extension.
That’s odd. Were you changing the Y before or after turning on relative to camera? Did you try using the block that’s “set position” with both x and y in one block?
My good sir, I recommend using a system where you change a variable each time you get a coin and then use that to change some text from the arcade text extension to make the visual part.
Sense it’s a Mario game, you might want to add a condition where if the variable gets to 100, set that to 0 and add a life, turning the variable to 0 first to make sure there are no glitches.
For an easy way of making the variable the score, simply set the score to the variable if you die on zero lives.
Doing this should allow you to easily replicate the Mario score system.
If you need further instructions, just ask!
Turns out I was trying to keep them in screen and infinitely set their location to (0,-99999999) at the same time as having it relative to screen, so it was overriding itself. Thanks for the help!
Also, is there any way to condense my "On (sprite) of type (player) overlaps (othersprite) of type (player) blocks? I have a bunch of them with the same function, and they take up a lot of my space and make it hard to find things.
I already have this system in place (besides the life system; thats one of my next tasks), my question was how to get it to stay in the top corner when the camera moves. I figured it out, though.
On your second question, the answer is… uhh… not really… for you…? I’m sure someone could figure out an extension for that, but at the moment not really, unfortunately. What I usually do is collapse them all and move them far away, but then you can’t use the “format blocks” button and that’s annoying. If someone wants to make a tiny extension for that, be my guest. I’ll have a computer in 4 weeks and if I remember (or someone reminds me hint hint) then I’ll look into it. Unfortunately this isn’t a problem that many people have, because people usually use each overlap in semi-different ways and so it isn’t useful.
Edit to say that I’m not being mean and saying it’s way over your head or anything, and if you want to take a stab at extension creation that would be really cool and stuff