Screen by Screen scrolling for game

Hi Everyone !

I want to have a screen by screen scrolling like the first Zelda. There were a previous topic but unfortunatly it don’t work with me. Screen-by-screen scrolling

Sorry to post again this topic but for me if it’s possible to have more informations ?

Thanks in advance !

Maybe you can change the position of camera. For example:
If X position of Player > 128, change the position of camera to 192

1 Like

Search zelda into the forum I think @Silver-Streak has already made an example of what you want.
Edit: [Example] A Top Down Action RPG/Action Adventure (AKA Zelda) style camera example

3 Likes

Tanks for all. Gdevelop Community is amazing !

Finally I found the good code. For Example a 256x144 game (16/9 ratio with tiles of 16 pixels)
Change the X position of Camera set to +128+floor(knight.PointX(“Center”)/256)*256
Change the Y position of Camera set to +72+floor(knight.PointY(“Center”)/144)*144

128 is 256/2 and 72 is 144/2 to have the middle of the screen

2 Likes

To get the middle of the screen regardless of the resolution, use

ScreenWidth()/2

and

ScreenHeight()/2

1 Like

That only works if you haven’t moved the camera.

I like to use CameraX(“”,0) and CameraY(“”,0)

2 Likes

Yeah! :+1::+1::+1::+1:

For reference I’m pretty sure they’re just copying the comments from my example project.

The part they’re missing is that is explaining what a tween is doing to a camera object’s position. Anyone reading the comment posted above is going to be missing half the context without that info.