• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Following A Zelda-1 style screen transition tutorial, but it makes my room slightly tilted.

01Warlock10

Member
Hey all, so I was following this guide on Zelda 1 screen transitions (
), and it works, but for some reason it makes the rooms slightly tilted.
I'll give some info and see if y'all can help:
All of my rooms have a view of 352, 352.
Here's all the code related to the camera object:
Create:
target_x = 0;
target_y = 0;
spd = 20;
view_camera[0] = camera_create_view(0,0,352,352, -1, -1, -1, 0, 0);


Step Event:
target_x = (global.player.x div camera_get_view_width(view_camera[0])) * camera_get_view_width(view_camera[0]);
target_y = (global.player.y div camera_get_view_height(view_camera[0])) * camera_get_view_height(view_camera[0]);
if(abs(x - target_x <spd)) {
x = target_x;
} else {
if(target_x > x){
x += spd;
} else if(target_x < x){
x -= spd;
}
}

if(abs(y - target_y <spd)) {
y = target_y;
} else {
if(target_y > y){
y += spd;
} else if(target_y < y){
y -= spd;
}
}
camera_set_view_pos(view_camera[0], x, y);


that's all I can give. (Sorry If this is kind of amateaur, I'm 16 and I'm still learning GML.
v Photo of the tilting v

Created with GameMaker Studio 2 2021-11-25 3_57_56 PM.png
 
Top