Jump to content


Photo
- - - - -

Room Warping Example


  • Please log in to reply
15 replies to this topic

#1 voltain

voltain

    V.C.G

  • GMC Member
  • 174 posts

Posted 15 October 2009 - 03:21 PM

  • Title: Voltain's Room Warping Example
  • Description: Easy-to-use room warping system which is very editable, perfect for RPG and Adventure games.
  • GM Version: GM7
  • Registered: No
  • File Type: GMK
  • File Size: 41kb
  • File Link: Version 1 , Version 1.1

Additional Info
This is a room warping system which makes use of 2 dimensional arrays. A player can walk through one end of a room, and appear in the beginning of another room, similar to the style of games like zelda and pokemon. It is an easy and compact system which only requires a few lines of code compared to typing out loads of seperate codes.

You can also do this with a ds grid but I decided to do it with arrays because it was simpler and just to help out the people who are stil confused about them. I made this a couple of days ago as an experiement. Feel free to ask questions, report bugs and errors or give any suggestions and improvements.

Updates

Version 1.1 released
I hadn't really intended on working on this more but I decided I may as well since it seems to be helping people. This version has some extra functions for editing the map after it has been created.

Edited by voltain, 23 October 2009 - 09:27 PM.

  • 0

#2 fredcobain

fredcobain

    GMC Member

  • GMC Member
  • 165 posts

Posted 16 October 2009 - 05:56 PM

Congratulations! It is the best I've seen here!

=)
  • 0
I am an Posted Image in the GM Quiz!

#3 Alex_Games

Alex_Games

    GMC Member

  • New Member
  • 186 posts

Posted 18 October 2009 - 10:36 AM

Thanks; I might try to see if this works in my game
  • 0

#4 Ace

Ace

    GMC Member

  • GMC Member
  • 372 posts

Posted 19 October 2009 - 10:22 PM

That's actually a very good example!

Maybe you would want to put the origin centered in the sprite to make it not appear odd as it changes rooms. Also, it would be very useful to include the functionality to use the map_warp() with an argument to go to a specific room and truly "warp" while assigning to the grid x,y the values that are associated with that particular room.

It'd make it a tiny bit more complicated, but infinitely more useful.
  • 0
Posted Image Posted Image Online Fighting & Roleplay Game

ZERO ENGINE
Posted Image

#5 gamma

gamma

    GMC Member

  • GMC Member
  • 123 posts

Posted 20 October 2009 - 12:52 PM

Ver good example, this is just what I was looking, much easier then what I had been doing (which was lining the walls with invisable objects to move to a certain room)
  • 0
If you will be laughing on December 22 2012, put this in your sig.
98% of the teenage population has smoked, if you are one of the proud 2% that never will, put this in your sig.

#6 raghuworld

raghuworld

    GMC Member

  • New Member
  • 1 posts

Posted 20 October 2009 - 03:05 PM

  • Title: Voltain's Room Warping Example
  • Description: Easy-to-use room warping system which is very editable, perfect for RPG and Adventure games.
  • GM Version: GM7
  • Registered: No
  • File Type: GMK
  • File Size: 41kb
  • File Link: Download Here

Additional Info
This is a room warping system which makes use of 2 dimensional arrays. A player can walk through one end of a room, and appear in the beginning of another room, similar to the style of games like zelda and pokemon. It is an easy and compact system which only requires a few lines of code compared to typing out loads of seperate codes.

You can also do this with a ds grid but I decided to do it with arrays because it was simpler and just to help out the people who are stil confused about them. I made this a couple of days ago as an experiement. Feel free to ask questions, report bugs and errors or give any suggestions and improvements.


Thank you so much for such a wonderful coding. However can v make it still more simple? like, can v use the built-in variables/buttons from the objects panel to do the same job instead of writing such codes?
I got 1 doubt, I created a mario kind of game, and i used your script, it works great but... when my character moves from 1 room to another, it just hangs out at the start of the next room. and I need to jump my character in order to make it run.
what could possibly b the problem? if you can identify the mistake in my game and set it right, it would b of a great hlp to me.

thankyou

Edited by raghuworld, 20 October 2009 - 03:06 PM.

  • 0

#7 voltain

voltain

    V.C.G

  • GMC Member
  • 174 posts

Posted 20 October 2009 - 05:19 PM

Wow, I am utterly flabbergasted (yes, flabbergasted) at the replies this topic has received! Thank you for all the compliments and suggestions.

Ace- That's just what I was thinking of doing. I will probably add some functions to allow the character to warp to certain rooms and also allow them to warp from a specific location (like when they enter a door that is in the centre of the room).

Raghuworld - It may depend on the origin of the sprite, perhaps some variables to do with your character, any objects that maybe blocking your character, gravity, etc. There are many possibilities to the cause. Could you describe exactly what happens or load an example for me to see the problem? I also doubt someone can make this stuff without coding (and if they did, it wouldn't be very customisable).

I may also add some functions that will map the rooms to the grid without having to enter them manually, possibly using the room index numbers.
  • 0

#8 voltain

voltain

    V.C.G

  • GMC Member
  • 174 posts

Posted 23 October 2009 - 09:28 PM

UPDATE (see first post).
  • 0

#9 guitarman4545

guitarman4545

    GMC Member

  • GMC Member
  • 539 posts
  • Version:GM:Studio

Posted 27 October 2009 - 06:56 PM

This is cool, I like how theres a visible "grid" in the script code.

I have been using something similar for alot of my games, basically does the same thing except it has to do with the room creation code, north=room1, east=room2 etc.

got 1 doubt, I created a mario kind of game, and i used your script, it works great but... when my character moves from 1 room to another, it just hangs out at the start of the next room. and I need to jump my character in order to make it run.
what could possibly b the problem? if you can identify the mistake in my game and set it right, it would b of a great hlp to me.


For platformers, I had the same problem. The problem is the gravity, you need to add more solid floor objects outside of the room to make them flow more smoothly. It fixed my problems. I used this..

Obj_solid create event:

if x=room_width-16
{instance_create(x+16,y,obj_solid)}
if x=0
{instance_create(x-16,y,obj_solid)}

Replace 16 with your sprite width.
  • 0
Posted ImagePosted ImagePosted Image

#10 pngnman

pngnman

    GMC Member

  • New Member
  • 178 posts

Posted 23 July 2010 - 07:32 PM

Okay, this has happened for every room switching tutorial that I've tried to use. Whenever I switch to the new room, my character does not follow. Is there something that I'm forgetting to do? My character does not appear in the new room.

Posted Image

Can you please look at this and help me?
  • 0

#11 lasttea999

lasttea999

    GMC Member

  • GMC Member
  • 290 posts

Posted 26 July 2010 - 04:54 PM

Very nice! It's very easy to understand.

One thing, though: Don't all the rooms have to be the same size for the scripts to work properly? map_warp() only records the room_width and room_height of the current room, right? So if you walked off the left edge of the screen into a room with a larger room_width, wouldn't you end up appearing somewhere left of the right edge of the room?

Also, for the people that are saying something along the lines of "the character doesn't follow": are you talking about how you have to press the key to walk again when you go into a new room? In other words, if you walk into another room, you can't keep holding the walk key to keep walking; you have to press it again. Is that what the problem is?

I think that might be a problem with Game Maker, or a problem between some computers and Game Maker --- the program has problems with registering pressed keys (the Keyboard event, and maybe some others) between rooms.

Edited by lasttea999, 26 July 2010 - 04:55 PM.

  • 0
Posted ImagePosted Image

#12 Bullet Market

Bullet Market

    GMC Member

  • GMC Member
  • 2 posts
  • Version:Unknown

Posted 23 September 2012 - 07:26 AM

Hmm.. This really helps me out, but I want it to start from the room, that is in the center of this whole map
...I can't solve this thing by myself :wacko:

Edited by Bullet Market, 25 September 2012 - 04:46 PM.

  • 0

#13 pwyskowski

pwyskowski

    GMC Member

  • GMC Member
  • 195 posts
  • Version:GM:Studio

Posted 05 October 2012 - 07:49 PM

Hmm.. This really helps me out, but I want it to start from the room, that is in the center of this whole map
...I can't solve this thing by myself :wacko:


My example might be a little easier for you as it is for GM8.1 and doesn't use an array for the room positions.

http://gmc.yoyogames...howtopic=539638

I hope this helps. :cool:
  • 0

#14 frank0127

frank0127

    GMC Member

  • New Member
  • 5 posts
  • Version:GM8.1

Posted 16 April 2013 - 02:47 PM

Is there any way to add screen transitions to this, i.e., when warping from one room to the next in the grid, display a screen transition between the two?


  • 0

#15 FodderBot

FodderBot

    GMC Member

  • GMC Member
  • 76 posts
  • Version:GM:Studio

Posted 20 April 2013 - 03:07 AM

Kind of the Blind leading the blind here, but you could try putting up an image in a forground layer that coveres everything (but UI if you have any) and then have that same Forground image in the new room that is visible when room gets created, and then deactivate the Foreground image in the new room once its loaded.

 

Just a thought.


  • 0

Carpe Draconis Cauda

 

WardogMechAnimation_150-1.gif


#16 DelziLorraine

DelziLorraine

    GMC Member

  • New Member
  • 1 posts
  • Version:GM8.1

Posted 04 March 2016 - 03:49 PM

Well, this thread a unbelievably old, but I'm not really certain what else to do. I don't usually use forums for anything, so I don't have any sort of idea of "forum etiquette", I guess.

 

I wanted to try to ask though if anyone can help me figure out what numbers should be in the xxm/yym variables (as well as other variables, probably.)

 

CctyO57UYAAN8v8.jpg

 

This is the basic map of what I'm trying to put together. The green circle just shows a warp that i'll need to insert for after the player gets through the sixth room.

 

Honestly, I'm not certain if anybody will see this and/or be able to help me figure this out, I'm not even certain if there's a better place for me to post this. I'm just pretty confused as to what I'm doing.


  • 0