I’m trying to figure out how to make a SHMUP style game (like Ikaruga or Battle Garegga) where the screen scrolls up, and I’m immediately stumped.
How can I get the camera to continue scrolling upwards regardless of what direction the player is trying to go? (I tried having the player’s velocity constantly pull them up with the camera following the player, but the game basically pauses in place every time the player moves, and I want them to be able to freely move around the screen while it scrolls.
Here’s my demo if you want to see what I have (all there is to it is dodging rocks while the character moves upward).
Ok, so first scrap the camera code you have for now and remove the “set mysprite velocity to -100 y” from the game update function. Now go to the on start function and put a “set variable” block there. Now name the new variable something like “cameraPositionY” and set it to zero. In the game update function do this: "change cameraPosY by -1. Then after that, also in the game update block put the “center camera at x0 y0”. In the x field put the “mySprite x” block (you can find it in the sprite category) and in the y field put “cameraPositionY”. I’m not on my computer rn so let me know if that works. If you have further questions, feel free to ask! Bye
You can either do this (make a separate invisible sprite for the camera to track), https://makecode.com/_bCaeV70Wkg5r
or you can set the camera to mysprite position on start, then use a forever block to constantly change the y position of the camera by -1. On game update blocks don’t work. Why I think on game update blocks don’t work (I could be wrong) the on start blocks go before the forever blocks start and I think the on game update is working at the same time as the on start and making the camera go to the top, so I just use a forever block.
Hmm, I think game update is still gonna work
I tried this, but I couldn’t quiet figure it out. I think it could work with more effort though. Thanks for the suggestion.
Both of these work way better than what I was doing. The only problem I have now is that when I stop moving the duck the camera with catch up to the duck and push it forward. In in most shmup games your character will stay in the middle of the screen if you stop.
I fixed that problem. I made an if statement that gets the sprite to move upward if I stop inputting the control to move up, so the camera won’t catch up to the sprite. Thanks again for the help!