• 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!

Legacy GM RPG Clouds (Overhead)

M

Murr_

Guest
Okay so i was trying to do myself, but i keep getting into some problems. First i'm trying to make this: clouds in the atmosphere effect, from up above.

Fara & The Eye of Darkness - ZackBellGames


Hyper Light Drifter - HeartMachine


You see those clouds scrolling horizontally across the screen. This is the effect i want to achieve, using SURFACES. I already done some work already but although not much.

Code:
///CREATE: Initialize the surface*************************************************************************
surf_overworld = surface_create(view_wview[0], view_hview[0]);

hspeed = 2;

scroll_num = 1;
Code:
///DRAW: Draw the surf_overworld**********************************************************************
scroll_num += hspeed

if (!surface_exists(surf_overworld)) {
   surf_overworld = surface_create(room_width, room_height);   
}

surface_set_target(surf_overworld);
draw_clear(c_black);
draw_background_general(bg_overworld_cloud_map, -254, 256, 256, 256, x, y, 4, 4, 0, c_black, c_black, c_black, c_black, 1);

surface_reset_target();

if (surface_exists(surf_overworld)) {
    draw_surface_ext(surf_overworld, x, y, 1, 1, 0, c_white, 0.6);
}
The problems with this, is that i only get a huge single rectangle part of the BG and not almost all of it. And also it does not loop continuously.

bg_overworld_cloud_map (256, 256);


Room Size: 940 x 680

Any suggestions or ideas?
 
B

bojack29

Guest
What you could do is simply have a cloud object with many different cloud sprites. As they move across the screen, have them draw themselves to a global surface and draw the surface with an alpha around .7. Youll have to clear the surface after every frame tho. This way you can have clouds that dont add in alpha values.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Okay, first you are creating the surface as the size of the view, but in the check of the draw event you have the room size... which is it? Next, you will want to set the the surface to draw at the view x/y position and scroll the background along that. You are also drawing the background at the x/y position which is wrong as you want to draw it at the (0, 0 + scroll_num) position - all surface drawing is done from (0,0). Finally, you want to use draw_clear_alpha to clear the alpha of the surface to 0 before drawing, and I'd use draw_background_tiled instead of the general function so that you don't have to worry about it repeating incorrectly...
 
M

Murr_

Guest
Okay, first you are creating the surface as the size of the view, but in the check of the draw event you have the room size... which is it? Next, you will want to set the the surface to draw at the view x/y position and scroll the background along that. You are also drawing the background at the x/y position which is wrong as you want to draw it at the (0, 0 + scroll_num) position - all surface drawing is done from (0,0). Finally, you want to use draw_clear_alpha to clear the alpha of the surface to 0 before drawing, and I'd use draw_background_tiled instead of the general function so that you don't have to worry about it repeating incorrectly...
So what i interpreted from this, and i changed.
Code:
///Draw the surf_overworld**********************************************************************
scroll_num += hspeed

if (!surface_exists(surf_overworld)) {
   surf_overworld = surface_create(room_width, room_height); 
}

if (surface_exists(surf_overworld)) {
    surface_set_target(surf_overworld);
        draw_clear_alpha(c_black, 0);
        draw_surface(surf_overworld, 0, 0);
        draw_background_tiled(bg_overworld_cloud_map, 0, 0);
   
    surface_reset_target();
}

draw_surface_ext(surf_overworld, 0 + scroll_num, 0, 1, 1, 0, c_black, 0.6);
When i do this, it still doesn't draw the BG. And NOTE: In the create event i changed the created surface to the size of (room_width, room_height).
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Okay, try this:

Code:
scroll_num += hspeed

if (!surface_exists(surf_overworld)) {
   surf_overworld = surface_create(room_width, room_height);
}
else {
    surface_set_target(surf_overworld);
    draw_clear_alpha(c_black, 0);
    draw_background_tiled(bg_overworld_cloud_map, 0, scroll_num);
    surface_reset_target();
    draw_surface_ext(surf_overworld, 0, 0, 1, 1, 0, c_black, 0.6);
}
 
M

Murr_

Guest
Okay, try this:

Code:
scroll_num += hspeed

if (!surface_exists(surf_overworld)) {
   surf_overworld = surface_create(room_width, room_height);
}
else {
    surface_set_target(surf_overworld);
    draw_clear_alpha(c_black, 0);
    draw_background_tiled(bg_overworld_cloud_map, 0, scroll_num);
    surface_reset_target();
    draw_surface_ext(surf_overworld, 0, 0, 1, 1, 0, c_black, 0.6);
}
Ah, i see. Thanks i didn't notice that you had to only had to draw the surface at the end, and my scroll_num was supposed to hold a argument. Thanks dood! I can finally start doing some mad, crazy things!
 
Top