Question - Code (solved) Copying app surface drawn other translucent rectangle

Discussion in 'GameMaker Studio 2 Community Tech Support' started by Yoon-SeokJin, Jul 14, 2019 at 12:03 PM.

  1. Yoon-SeokJin

    Yoon-SeokJin Member

    Joined:
    Sunday
    Posts:
    3
    I got problem when I copy application_surface to surf_pause which is used to pause game.

    When pausing game by pressing P key, it remain afterimage on surf_pause

    I thought that this remain because surf_pause is translucent

    I have known that even if draw translucent box where alpha value is 1, still alpha value is 1

    However, if a translucent box is drawn on the application surface when the application surface is copied to surf_pause and then drawn, the output surface will also be translucent.
    (I tried drawing surf_pause on draw_GUI event and the output of draw event was seen faintly)

    I want that surf_pause is opaque.

    What should I do?

    Create Event:
    Code:
    is_pause = false
    surf_pause = -1
    Step Event:
    Code:
    if !surface_exists(surf_pause)
    surf_pause = surface_create(surface_get_width(application_surface), surface_get_height(application_surface))
    
    draw_set_alpha(0.5)
    draw_rectangle(0,0,room_width, room_height, 0)
    draw_set_alpha(1)
    
    if is_pause
    {
        draw_surface(surf_pause, 0, 0)
    }
    
    if keyboard_check_pressed(ord("P"))
    {
        is_pause = !is_pause
        if is_pause
        {
            surface_copy(surf_pause, 0, 0, application_surface)
            instance_deactivate_all(1)
        }
        if !is_pause
        {
            instance_activate_all()
        }
    }
     
  2. Yoon-SeokJin

    Yoon-SeokJin Member

    Joined:
    Sunday
    Posts:
    3
    I still need help..
     
  3. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,164
    You should use the Draw GUI event to draw the copied surface instead of the Step event.
     
  4. Yoon-SeokJin

    Yoon-SeokJin Member

    Joined:
    Sunday
    Posts:
    3
    Oh, I'm sorry.
    I solved this problem by the way of drawing surfaces and rectangle separately.
    thanks for commenting.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice