Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Dargor's Map Layers for XP

JoshC

Member

Ok, having a little difficulty with your script Seph. I'm trying to make it only copy a section of a map to another. I.e. if the map is a 15x15 copy rect(3,4-6,5); I'm copying from map 2 - map 1, and just pasting it into a similar section.

Code:
$game_map.add_map_layer(1, 2, \

Rect.new(7,4,11,0), 7, 4, false)

 

But when I call it it doesn't show up, what am I doing wrong?
 
Seph? :P Don't you mean me? ;)

Your code seems good. Now let's see if you used the right values to the right places.

Destination map ID: 1
Source map ID: 2
Rect from source map: x=7, y=4, width = 11, height = 0
X offset on Dest. map: 7
Y offset on Dest. map: 4
Copy events: False

Everything is OK except for the height of the Rect.
This won't work if no width/height is specified or if it's smaller than 1.

That's all!
-Dargor
 

JoshC

Member

Sorry, guys, you two are always the ones that help me out so I sometimes get you confused.

Ok so let me make sure I've got the concept right, by width and height you mean the tile width and height of the space to copy, not like coord x,y - x,y.

If so then it should be:
Code:
$game_map.add_map_layer(1, 2, \

Rect.new(7,4,5,4), 7, 4, false)

 

However when I use this it still doesn't appear.

P.S. Sorry about the wrong section thing.... :(
 
It's the width/height (in tiles) of the zone you want. the first 2 arguments of the rect are the origin x/y.

So Rect.new(7,4,5,4) means, Start at 7,4 and take a zone of 5x4 from there.
 

JoshC

Member

lol, ok at first I was thinking coord system. However, I made the appropriate changes and it still does not copy that particular section of tile, is there a particular layer it's suppost to be on or something that I'm missing?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top