PDA

View Full Version : tilebased rpg questions



oicu812
January 20th, 2005, 02:29 PM
Heys,

Ive been developing a classic rpg for a few months now. Have a thick stack of papers on my desk which contains: characters, encounters, inventory, npc scripts, scenes(battle), story, tilesets, and quests.

This is my first attempt in creating a rpg in flash. The road thus far has been a struggle even if just conjured on paper. I dont expect the road to get easier, infact Im expecting the worse. However, since im still learning flash... I have some questions.

1. Concerning tile map editors:

1a. Does a map editor have to be within the game.swf or can it be seperate from the game in its own t-edit.swf?

1b. My tiles are fairly small, and there are many that need to be seperated. Im wanting to have a box at the bottom of my tile editor, with 4 tabs above it named: dungeon, town(outdoor), town(indoor), worldmap. When each tab is pressed it will display rows of tile buttons that go with the tab name, and can be used. Any advice or examples of how I would go about creating this feature to my editor?

2. Concerning tiles & battle screen backgrounds:

2a. Some examples of my walkable tiles are grass,and graveyards. My dude can walk around and hit a random encounter, which starts a battle system which I dont have yet and not really worring about at the moment. However, the battle screen background is white. Ive created some backgrounds but dont know how to use them. Here is what I want to happen. When player is hit with an encounter it checks what tile he is on. If its a grass tile the battle screen will load the grassy backround, if its a graveyard the battle screen will load the graveyard backround, and etc. How do I tie the tiles to the (battlescreen)backgrounds?

The answers might be simple to these questions, but im still learning. Any help will be appreciated.

-oicu812

oicu812
January 23rd, 2005, 02:40 AM
1a. [resolved]

1b. [resolved]

2a. [resolved]


Have a few new questions tho concerning tilemap editor features:

3a. has anyone coded a 'reset map button'? code examples?
-when button is clicked it resets all tiles to grass.

3b. has anyone coded a 'fill map button'? code examples?
-when a tile is clicked and then 'fill map' is clicked fill the map with selected tile.

oicu812
January 24th, 2005, 04:53 PM
3a. [resolved]

3b. [resolved]

Have a new problem. I drew a box with a dark color "stroke" (to act as a border), and light color "fill" over my stage, as a background. but when MapMaker function builds the grid it places the grid directly topleft covering the dark border. Is there a way to set the x,y cords to start building the grid in a certain spot?

what Im wanting , |=box border , 2= grid that Mapmaker builds

|||||||
|2222
|2222

but this is whats happening

2222|
2222
|

attached code from stage frame 1 below:





selectedTile = 4;
mapString = String;

mvWdth = 230;
mvHght = 330;
tileWdth = 23;
tileHght = 23;

//too may tiles to post, gives general idea
tile4 = function () {}; //grass
tile4.prototype.pos = 1;
tile4.prototype.barrier = false;

map1 = [[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4]];

function MapMaker (map) {

_root.attachMovie("blank", "tiler", d++);
var mapWdth = map[0].length;
var mapHght = map.length;
for (var i = 0; i < mapHght; i++) {

for (var j = 0; j < mapWdth; j++) {
var name = "tile_"+j+"_"+i;
_root[name] = new _root["tile"+map[i][j]];
_root.tiler.attachMovie("TileSet1", name, i*100+j*2);

_root.tiler[name]._x = (j*_root.tileWdth);
_root.tiler[name]._y = (i*_root.tileHght);
_root.tiler[name].gotoAndStop(_root[name].pos);

}
}

}

MapMaker(map1);

SeiferTim
January 24th, 2005, 05:56 PM
3a. [resolved]

3b. [resolved]

Have a new problem. I drew a box with a dark color "stroke" (to act as a border), and light color "fill" over my stage, as a background. but when MapMaker function builds the grid it places the grid directly topleft covering the dark border. Is there a way to set the x,y cords to start building the grid in a certain spot?

what Im wanting , |=box border , 2= grid that Mapmaker builds

|||||||
|2222
|2222

but this is whats happening

2222|
2222
|

attached code from stage frame 1 below:





selectedTile = 4;
mapString = String;

mvWdth = 230;
mvHght = 330;
tileWdth = 23;
tileHght = 23;

//too may tiles to post, gives general idea
tile4 = function () {}; //grass
tile4.prototype.pos = 1;
tile4.prototype.barrier = false;

map1 = [[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4]];

function MapMaker (map) {

_root.attachMovie("blank", "tiler", d++);
var mapWdth = map[0].length;
var mapHght = map.length;
for (var i = 0; i < mapHght; i++) {

for (var j = 0; j < mapWdth; j++) {
var name = "tile_"+j+"_"+i;
_root[name] = new _root["tile"+map[i][j]];
_root.tiler.attachMovie("TileSet1", name, i*100+j*2);

_root.tiler[name]._x = (j*_root.tileWdth);
_root.tiler[name]._y = (i*_root.tileHght);
_root.tiler[name].gotoAndStop(_root[name].pos);

}
}

}

MapMaker(map1);


Sorry I didn't see this earlier:


selectedTile = 4;
mapString = String;

mvWdth = 230;
mvHght = 330;
tileWdth = 23;
tileHght = 23;

bufferX = 5; //this is how far over to the right you want the map to appear
bufferY = 5; // this is how far down you want it to appear.

//too may tiles to post, gives general idea
tile4 = function () {}; //grass
tile4.prototype.pos = 1;
tile4.prototype.barrier = false;

map1 = [[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4],
[4,4,4,4,4,4,4,4,4,4]];

function MapMaker (map) {

_root.attachMovie("blank", "tiler", d++);
var mapWdth = map[0].length;
var mapHght = map.length;
for (var i = 0; i < mapHght; i++) {

for (var j = 0; j < mapWdth; j++) {
var name = "tile_"+j+"_"+i;
_root[name] = new _root["tile"+map[i][j]];
_root.tiler.attachMovie("TileSet1", name, i*100+j*2);

_root.tiler[name]._x = (j*_root.tileWdth + bufferX);
_root.tiler[name]._y = (i*_root.tileHght + bufferY);
_root.tiler[name].gotoAndStop(_root[name].pos);

}
}

}

MapMaker(map1);



That should fix it.

Oh, and for the "Reset Map", the only thing I would do is remove the clip that the movie is drawn in, and then re-attach it again. See page 8 of my tutorial (which Kirupa hasn't put up on his site yet):

http://seifertim.no-ip.com/rpgTut/page08.htm



-- I noticed you just put "[resolved]" for problems you worked out, but it would probably be helpful to everyone if you went into some detail...

oicu812
January 24th, 2005, 07:15 PM
Thanks a bunch, SeiferTim.

Ya I plan on editing those [resolved] from above soon. They are currently not coded into my editor.. did a small test on each code to make sure it would work. Wanted to wait until I fixed this gui problem, so when I placed things everything would line up. Im actually in the process of typing up tutorial on adding special features to map editors. But this might take me some days. Would be cool tho if anyone could post other features I didnt mention above with code examples. Its a forum thread I feel most flash forums are missing, but benefits everyone doing tbw's.

By the way how's you page 10 coming along?