Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411526 Posts in 69377 Topics- by 58432 Members - Latest Member: Bohdan_Zoshchenko

April 28, 2024, 08:43:06 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)TutorialsGM: NES Zelda Room Changing
Pages: [1]
Print
Author Topic: GM: NES Zelda Room Changing  (Read 7423 times)
Zack Bell
Level 10
*****



View Profile WWW
« on: July 10, 2011, 01:39:20 PM »

Another Game Maker question...

Have a tough time getting my room transitions to appear like the original NES LoZ game.

Meaning exit one room via the south east corner, then enter the adjacent room from the south west corner.

Best way to handle multiple exits in rooms and appearing in the right places in the adjacent rooms?

Help is appreciated Smiley

EDIT: I believe that my player object needs to be persistent. Then I either adjust the x if I'm exiting left or right  or the y if I'm exiting up or down.
Something along those lines...
« Last Edit: July 10, 2011, 04:07:46 PM by codetroll » Logged

Zack Bell
Level 10
*****



View Profile WWW
« Reply #1 on: July 10, 2011, 07:52:25 PM »

I fixed it guys, no worries Wink

But if anyone knows how to make the screen scroll in from the direction you're headed, let me know! (Again, look at LoZ if you don't know what I mean, conceptually)
Logged

Geeze
Level 5
*****


Totally.


View Profile
« Reply #2 on: July 10, 2011, 10:07:30 PM »

I fixed it guys, no worries Wink

But if anyone knows how to make the screen scroll in from the direction you're headed, let me know! (Again, look at LoZ if you don't know what I mean, conceptually)
I'm not sure if there is a room transitions extension for GM(99% Sure that there is)
But that desired effect can also be achieved with surfaces. I wont go to any details as Im busy right now, and if you wanna figure it out by yourself
Logged

ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #3 on: July 11, 2011, 01:20:03 AM »

I fixed it guys, no worries Wink

But if anyone knows how to make the screen scroll in from the direction you're headed, let me know! (Again, look at LoZ if you don't know what I mean, conceptually)

you probably wouldn't want to do that unless everything lines up exactly right at the borders between the two rooms, otherwise it'd look weird to have mismatched tiles and stuff
Logged

Zack Bell
Level 10
*****



View Profile WWW
« Reply #4 on: July 11, 2011, 05:36:05 AM »

Thanks guys, I was actually looking into the Grandma Engine. Just for prototyping and for learning's sake.
I'd prefer not to use it for the final version of my game. The code in the engine is very neat though, I like it.

I fixed it guys, no worries Wink

But if anyone knows how to make the screen scroll in from the direction you're headed, let me know! (Again, look at LoZ if you don't know what I mean, conceptually)

you probably wouldn't want to do that unless everything lines up exactly right at the borders between the two rooms, otherwise it'd look weird to have mismatched tiles and stuff

And yeah, I thought about this. Unless I cut all the rooms down to the same size (like LoZ), it doesn't look great.
Logged

s0
o
Level 10
*****


eurovision winner 2014


View Profile
« Reply #5 on: July 11, 2011, 07:38:32 AM »

I've had that type of movement between rooms in my (now cancelled) game 444. The scrolling effect is actually one of GM's built-in room transitions IIRC.
Logged
Zack Bell
Level 10
*****



View Profile WWW
« Reply #6 on: July 11, 2011, 09:35:57 AM »

I've had that type of movement between rooms in my (now cancelled) game 444. The scrolling effect is actually one of GM's built-in room transitions IIRC.

Haha yeah, I totally figured that out this morning. Embarrassing much  Embarrassed
Logged

sergiocornaga
Level 8
***



View Profile WWW
« Reply #7 on: July 11, 2011, 03:32:54 PM »

Matt Thorson has a system like this in the Grandma Engine (free) which I am using for my game "The Archer." Here is the code, which I've slightly modified.

I was going to use a system like this for a game I'm making, but the need for execute_string made me decide against it. But my only experience with execute_string has been reading people complaining about it and why never to use it... think I should just go with it anyway?
Logged
ஒழுக்கின்மை (Paul Eres)
Level 10
*****


Also known as रिंकू.


View Profile WWW
« Reply #8 on: July 11, 2011, 03:41:19 PM »

you don't actually need it, you can do that without it. i've a similar system in SD and i don't use execute string

also, execute string isn't a problem if you don't run it every step, it's only a problem to use it when the game is playing, not when loading between rooms. there's no reason to avoid it if it's used only once every few minutes
Logged

eiyukabe
Level 2
**



View Profile WWW
« Reply #9 on: July 11, 2011, 04:58:31 PM »

I've had that type of movement between rooms in my (now cancelled) game 444. The scrolling effect is actually one of GM's built-in room transitions IIRC.

Haha yeah, I totally figured that out this morning. Embarrassing much  Embarrassed

The GM built in room transitions are just full screen slides, which will move everything you're drawing (such as HUD elements and the PC). This may be fine for you, but if you want to have things (like HUD elements and the PC) stay in place on the screen while the environment moves behind them, this can be done with custom transitions and manual surface manipulation (as Geeze mentioned). I've implemented this for a similar setup before, let me know if you want more details and I'll dig it up.
Logged
Zack Bell
Level 10
*****



View Profile WWW
« Reply #10 on: July 11, 2011, 05:31:28 PM »

I've had that type of movement between rooms in my (now cancelled) game 444. The scrolling effect is actually one of GM's built-in room transitions IIRC.

Haha yeah, I totally figured that out this morning. Embarrassing much  Embarrassed

The GM built in room transitions are just full screen slides, which will move everything you're drawing (such as HUD elements and the PC). This may be fine for you, but if you want to have things (like HUD elements and the PC) stay in place on the screen while the environment moves behind them, this can be done with custom transitions and manual surface manipulation (as Geeze mentioned). I've implemented this for a similar setup before, let me know if you want more details and I'll dig it up.

For now (prototyping), GM's built in crap will be fine haha. But yeah, I'd love to hear more about how you did it just in case I take this project further in the furture! Thanks a lot!
Logged

eiyukabe
Level 2
**



View Profile WWW
« Reply #11 on: July 12, 2011, 06:59:27 PM »

For now (prototyping), GM's built in crap will be fine haha. But yeah, I'd love to hear more about how you did it just in case I take this project further in the furture! Thanks a lot!

Alright it's a little more complicated than I remembered so I'll try to simplify.

First, we used a persistent player character. Each room had a start that she would be spawned at if she didn't already exist so we could test a later room without having to play from the start.

When she collides with our exit objects, we set some global transition variables that let us do custom transitions (transition_steps and transition_kind) before calling room_goto(). Example: transition_kind = global.transitionDown;

global.transitionDown is a globally defined transition ID we set up during game initialization, starting at 22 because, I believe, the numbers before that are reserved for built in transitions.
 Example:
global.transitionDown = 25;
transition_define(global.transitionDown, "scr_transitionDown");

"scr_transitionDown" is a script that gets called every frame during a transition. We used it to draw the two rooms (the one you're leaving and the one you're going to) scrolling while moving our player character in slight parallax to the scrollrate of the rooms and keeping our HUD static. It was pretty basic, like this:

Code:
var previousRoomImage, nextRoomImage, width, height, transitionFraction;
previousRoomImage = argument0;
nextRoomImage = argument1;
width = argument2;
height = argument3;
transitionFraction = argument4;

draw_surface_part(previousRoomImage, 0, 0, 640, 600, 0, -600 * transitionFraction);
draw_surface_part(nextRoomImage, 0, 0, 640, 600, 0, 600 - 600 * transitionFraction);
 
draw_sprite(spr_princess, 1, global.preTransitionX + (global.transitionX - global.preTransitionX) * transitionFraction - global.leftBorder,
    global.preTransitionY + (global.transitionY - global.preTransitionY) * transitionFraction - global.topBorder);

scr_drawSidebar(640, 0, true, true);

In hindsight, the literal screen sizes were probably bad Sad. Oh well.

And of course we had four transitions depending on the direction you left the screen. Hope this helps.

Logged
Zack Bell
Level 10
*****



View Profile WWW
« Reply #12 on: July 12, 2011, 07:58:31 PM »

Thanks a lot! Great explanation and very helpful code! You don't mind if I implement it sometime?
Logged

eiyukabe
Level 2
**



View Profile WWW
« Reply #13 on: July 13, 2011, 05:31:43 PM »

I don't mind, I believe code should be free to share (well, as long as it's not the whole game Wink ). This is so small you don't even have to mention me or anything. Hope it works for you!
Logged
Zack Bell
Level 10
*****



View Profile WWW
« Reply #14 on: July 13, 2011, 06:02:55 PM »

Thank you!
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic