• 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!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Accurate Zelda 4 Style View Transitions?

S

Shadowblitz16

Guest
can someone explain how the new gms2 cameras work and how to achieve a zelda 4 style screen transition?
in zelda 4 (Link's Awakening)
there was a game window of 160 x 144px and there 2 maps with 256 screens (16x16), each screen was 160 x 128px making room for a passive hud of 160 x 16px.

I want my code so that it used a default background of pink when no view is present and a background black when a view is being drawn

I want to clamp link's position inside the current screen until he is at the edge pressing in the proper direction
and using a 1d screen index scroll the screen to the next screen -16: up, +16:down, -1:left, +1:right

the first question I was wondering about this topic is how to setup the camera's or views so that they display the proper colors?

I'm not sure what the difference is between views and cameras I suspect a view is the games view port to your game and a camera is a rect that the view shows?

Edit: here is my code

Code:
/// @description Set Up Enums
// You can write your code in this editor


BLayer0 = layer_get_id("BLayer0")
ILayer0 = layer_get_id("ILayer0")
TLayer0 = layer_get_id("TLayer0");
TLayer1 = layer_get_id("TLayer1");
TLayer2 = layer_get_id("TLayer2");
TLayer3 = layer_get_id("TLayer3");
TLayer4 = layer_get_id("TLayer4");
TLayer5 = layer_get_id("TLayer5");
TLayer6 = layer_get_id("TLayer6");
TLayer7 = layer_get_id("TLayer7");

Screen_Camera = camera_create();
                camera_set_begin_script(Screen_Camera, scr_camera_begin)
                //camera_set_update_script(Screen_Camera, scr_camera);
                view_set_camera(1, Screen_Camera);
              
Screen        = 0;
Screen_Prev   = Screen;
for (var i=0; i<256; i++)
{
    Camera_X1[i] = i * 160;
    Camera_Y1[i] = i * 144;
    Camera_X2[i] = Camera_X1[i] + 160;
    Camera_Y2[i] = Camera_Y1[i] + 144;
}
camera_set_view_pos(Screen_Camera, camera_get_view_x(Screen_Camera) + Camera_X1[Screen], camera_get_view_y(Screen_Camera) + Camera_Y1[Screen]);
camera_set_view_size(Screen_Camera, Camera_X2[Screen] - Camera_X1[Screen], Camera_Y2[Screen]- Camera_Y1[Screen]);

Code:
if ((Camera_X1[Screen] % 160 == 0) && (Screen != Screen_Prev))
{ Screen_Prev = Screen }

[code]
[/spoiler]

[spoiler=scr_amera_begin]
[code]
draw_set_color(c_black);
draw_rectangle(camera_get_view_x(self), camera_get_view_y(self), camera_get_view_width(self), camera_get_view_height(self), false);

layers = [TLayer7, TLayer6, TLayer5, TLayer4, TLayer3, TLayer2, TLayer1, Tlayer0, ILayer0, BLayer0 ] //going downwards
background color on background layer(BLayer0) == fully transparent
view0 view rect = (0,0,160,144)
view0 viewport rect = (0, 0, 640, 578)
view1 view rect = (0,16,160,128)
view1 viewport rect = (0, 0, 640, 512)
both obj_link and obj_game is on the ILayer0

Code:
window_set_color($ff00ff)
 
Last edited by a moderator:
S

Shadowblitz16

Guest
ok here is a better idea then just making a massive large room and is probably how they did it in the real games.
the gameplay only happens in one gms with a array of combos draw to screen
when link scrolls it loads the array of combos for the next room and scrolls the previous array out of the view and unloads it while scrolling the next array of combos into the view

combo's are basically tiles but hold animation, collision, types, and flags with the animation being an array of actual tiles, and collisions being a array of 4 8x8 rectangles per 16x16 combo

can someone explain how to do this in the most efficient and way?
 
Last edited by a moderator:
S

Shadowblitz16

Guest
@TimothyAllen thankyou however this explains how to do it with two rooms
I would be using json for my room data instead of actual gms rooms

also I am still having a hard time finding a way to store my combo data?
most of it is because I find ds_* very confusing and there isn't a way to do literal lists and maps yet
and find it very hard to use nested json the way it is now
 
Top