Microsoft MakeCode

Overlay Help

I’m trying to get my 10yo nephew interested in using MakeCode to make his own video games and finally struck a chord by asking if he wanted to work on a video game together about the superhero he created and has been writing about for the last few years.

After some discussion, he wants the character to have a couple different attacks: a melee attack and a blast attack. My thought is to have a general melee attack when the B button is pressed, and when enough energy is absorbed, a B button press will shoot a blast.

I’ve made some decent progress on including both forms of attack, and have gotten a power-indicator “overlay” sprite to show the power level, but I’m having trouble figuring out how to get it to stay in the same place on screen regardless of where the player sprite is.

Any help would be fantastic. Thanks!

Here is a related discussion, wit a solution using JavaScript -Cheers.

There is no way to do this in blocks. I think that I might add a SpriteFlag that prevents the camera from affecting a sprite; something like SpriteFlag.FixedCamera that you could set; would that work for you?

I’ll also propose some new camera blocks (but no promises)

Just merged some new APIs: https://github.com/microsoft/pxt-common-packages/pull/1013

This adds two blocks for getting the camera position (scene.cameraLeft() and scene.cameraTop()) and adds a new flag SpriteFlag.RelativeToCamera that makes the sprite draw relative to the camera and not interact with other sprites or the tilemap.

It should show up in beta shortly

1 Like

Oh man, that is awesome.
Thanks!