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

Windows Moving to GM2

A

Aero88

Guest
Hi guys! I have been working on a big project I started back in the days of GM 8. With each new version of Game Maker I have put in the work to update the game and keep it current with the software, but I was hesitant to make the jump to GM 2 from GM 1.4 knowing a lot had changed, and the game is very large now. I am a little worried about losing export compatibility with new devices if I don't make the jump though. So I'm taking a shot at it.

I imported my project and surprisingly it started up, and ran for the most part with a few notable issues. Not the least of which is a game breaking graphical glitch.

I used a lot of fading transitions between menus which looked great, but now running in GM2 the surfaces I was using are filled with what looks like the games texture pages, so I see tons of random sprites instead of the nice black fade in. I have tried using draw_clear_alpha to clean the surfaces, but it doesn't seem to do anything. Has anyone else experienced this know how to solve it? What is strange is that it doesn't seem to do it everywhere... Just in a few of my menus, and in the surface I use to create shock waves from explosions.


I still need to figure out how to convert my game from views to cameras as well, but I'll save those questions for another thread.

Thanks!
 

Gradius

Member
Sounds like you're using an invalid surface. Maybe you're not checking if they exist before drawing them, for instance. If you can find the code for the specific surfaces that arn't working that might be helpful.
 
A

Aero88

Guest
Here is one example of where it is messing up. Note this code worked flawlessly when running GM 1.4

Here is the original GM 1.4 Code to create the surface. The last function draws view[1] to the surface.
Code:
if !surface_exists(surf)
{
    surf = surface_create(view_wview[1]*global.Shockwave_Surface_Scale,view_hview[1]*global.Shockwave_Surface_Scale);
    surface_set_target(surf);
    draw_clear_alpha(c_black,0);
    surface_reset_target();
    view_surface_id[1] = surf;
}
Here is the converted GM 2 Code: (The functions with the double "_" are some form of compatibility function for legacy functions.
Code:
if !surface_exists(surf)
{
    surf = surface_create(__view_get( e__VW.WView, 1 )*global.Shockwave_Surface_Scale,__view_get( e__VW.HView, 1 )*global.Shockwave_Surface_Scale);
    surface_set_target(surf);
    draw_clear_alpha(c_black,0);
    surface_reset_target();
    __view_set( e__VW.SurfaceID, 1, surf );
}
It is possible the errant sprites are being drawn to the surface later somehow, but it didn't happen in GM 1.4. I don't know why a whole texture sheet would be drawn to my surface without calling functions to do that specifically.

Here is another example of where I draw a surface.
Code:
//Make sure the background surface exists
if !surface_exists(global.Message_Backdrop_Surface)
{
    instance_activate_all();
    if instance_exists(Level_Editor_Controller)
    {
        if Level_Editor_Controller.Level_Test == 1
        {
            instance_deactivate_object(LE_Object_Parent);
        }
    }
    Create_Background_Surface();
    instance_deactivate_all(true);
    instance_activate_object(Game_Controller);
    instance_activate_object(Game_Settings);
    instance_activate_object(Level_Editor_Controller);
    instance_activate_object(Level_Editor_Help_Menu);
    if global.Level_Failed == 0 //This variable is set in "Game_Controller" alarm[0] line 13
    {
        instance_activate_object(Game_Controller)
        if instance_exists(Game_Controller)
        Game_Controller.Open_Menu = 2
    }
}

//Draw the background
draw_set_alpha(1)
draw_set_color(c_white)

//draw_sprite(Back_Sprite,0,view_xview[0],view_yview[0])
draw_surface(global.Message_Backdrop_Surface,view_xview[0],view_yview[0])
Note that global.Message_Backdrop_Surface is created the same way that "surf' was created in the first two code blocks except that rather than drawing from a view, individual objects draw themselves to the surface before the surface is drawn.
 
Last edited by a moderator:
Top