0
\$\begingroup\$

I followed a tutorial on how to add a left swipe room transition, which works very well. My problem is that it won't scale to my Android display. I know that it's being drawn to the GUI layer and I've tried resizing the GUI to the display width and height but I didn't see any changes. It's a really nice effect that I want to get working for my game.

Create Event:

currentframe = 0
maxframes = 45

persistent = true; // when changing room keep this object alive

// copy the old room so we can display it on the second room
sur_oldroom = surface_create(room_width,room_height);
surface_copy(sur_oldroom,0,0,application_surface);

// We have recorded what the old room looks like so we can instantly go to the next room.
room_goto(rm_game);

Destroy Event:

surface_free(sur_newroom)
surface_free(sur_oldroom)

Step Event:

currentframe++

if (currentframe > maxframes) {
    instance_destroy() // The transition has finished so destroy it
}


// We are now on the second room so record that room. 
if (currentframe == 2) { 
    sur_newroom = surface_create(room_width,room_height);
    surface_copy(sur_newroom,0,0,application_surface);
}

Draw GUI Event:

if (currentframe > 1) {

    // convert the number of frames that have passed into a number between 0 and the room width
    var slideamount = EaseOutQuad(currentframe,0,room_width,maxframes)

    if (surface_exists(sur_oldroom)) {
        draw_surface(sur_oldroom,-slideamount,0)
    }

    if (surface_exists(sur_newroom)) {
        draw_surface(sur_newroom,room_width-slideamount,0)
    }
}


/// I do this to hide the flicker where the next room pops up for 1 frame 
if (currentframe == 1) { 
    if (surface_exists(sur_oldroom)) {
        draw_surface(sur_oldroom,0,0)
    }
}

I'm using Game Maker Studio 1.4.

\$\endgroup\$
0
\$\begingroup\$

I feel like the boy crying wolf, so sorry for that. Next time I encounter a problem, I'll just post it as how to fix that problem. Anyways in my screen manager object related to this post here: Can't scale properly to android device in Game Maker Studio 1.4, My solution was display_set_gui_size(ideal_width,ideal_height); after the line surface_resize(application_surface,ideal_width , ideal_height);

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.