Discuss Scratch

d20kadenalievans
Scratcher
2 posts

How to make a sprite stay in the MIDDLE of the screen.

I want to make the fish stay in the middle of the screen, but I want the ‘camera’ to be moving.

A great example would be the game Jetpack Joyride, the character is always in the middle, but the camera is moving.

Game: https://scratch.mit.edu/projects/506530055/editor/
FateSealer
Scratcher
100+ posts

How to make a sprite stay in the MIDDLE of the screen.

Well, you should make everything moving but the character.

@Griffpatch also uses such a technique in his platformer games.

d20kadenalievans
Scratcher
2 posts

How to make a sprite stay in the MIDDLE of the screen.

FateSealer wrote:

Well, you should make everything moving but the character.

@Griffpatch also uses such a technique in his platformer games.


How would I be able to do so?


FateSealer
Scratcher
100+ posts

How to make a sprite stay in the MIDDLE of the screen.

Either use a forever loop in order to periodically check if the right / left arrow is being pressed, or the event blocks:

when [ v] key pressed

So when any of the arrow keys are being pressed, you broadcast a message to your other (non-player) sprites.

Whenever these other sprites receive a broadcast message, they must move.
bluedragon8633
Scratcher
1000+ posts

How to make a sprite stay in the MIDDLE of the screen.

Put the movement code in the background, but not in the player sprite.
7salad3salad
Scratcher
1000+ posts

How to make a sprite stay in the MIDDLE of the screen.

Hear me out, i might be wrong but you could probably just have both the background and the fish move to make it look like the camera is moving?
Jelleck_Creates
Scratcher
22 posts

How to make a sprite stay in the MIDDLE of the screen.

Try doing this

when green flag clicked
forever
go to x: (0) y: (0)
end

Powered by DjangoBB