Study Flash 8 make Mode7 mode head .... Take the time to change the previous RPG engine with Flash 8.
Here is a brief introduction to the production of the map (this article is suitable for the tiles model to understand and have a certain understanding of the Flash8 people)
When I used to make games, I used to waste time trying to cut the map. Often for the map too large. Drag too much machine and worry. Now all this is not a problem. As long as you master the basic use of Flash8 bitmapdata.
After the transformation of the map used to import the whole topographic maps, by the as control of the cut call to generate the entire map, and then by Flash cut call to the appropriate scene.
The results are as follows (the map uses random mode for the time being, with the arrow keys to control the scrolling of the map)
The following code is posted:
Import Flash.display.BitmapData;
Import flash.geom.*;
Class _map {
var Timeline:movieclip;
var Maps:array;
var Bg:movieclip;
var tilebmd:bitmapdata;
var mapbmd:bitmapdata;
var bgbmd:bitmapdata;
var Tilestep:number;
var Tilecount:number;
var Tilerect:rectangle;
var Bgrect:rectangle;
var Width:number;
var Height:number;
var X:number;
var Y:number;
function _map (Timeline:movieclip, linkid:string, Maps:array, Tilestep:number, Width:number, Height:number) {
This.timeline = timeline;
This.width = width;
This.height = height;
this.x = 0;
This.y = 0;
timeline._x = (stage.width-width)/2;
Timeline._y = (stage.height-height)/2;
BG = timeline.createemptymovieclip ("bg", 0);
This.maps = maps;
Map Tile Range
Tilerect = new Rectangle (0, 0, Tilestep, tilestep);
Bgrect = new Rectangle (0, 0, width, height);
Create a MAP element
Tilebmd = Bitmapdata.loadbitmap (LinkId);
This.tilestep = Tilestep;
Tilecount = Tilebmd.width/tilestep;
Build a Map
Build ();
}
function Build () {
Mapbmd = new BitmapData (Maps[0].length*tilestep, Maps.length*tilestep, False, 0);
for (var y = 0; y<maps.length; y++) {
for (var x = 0; x<maps[0].length; x + +) {
Attach (0, x*tilestep, y*tilestep);
if (maps[y][x]<>0) {
Attach (Maps[y][x], x*tilestep, y*tilestep);
}
}
}
Bgbmd = new BitmapData (width, height, false, 0);
Bg.attachbitmap (Bgbmd, 0);
Bgbmd.copypixels (Mapbmd, Bgbmd.rectangle, New Point (0, 0));
}
function Attach (Id:number, X:number, Y:number) {
var rect:rectangle = Tilerect.clone ();
Rect.y = Math.floor (id/tilecount) *tilestep;
Rect.x = Id%tilecount*tilestep;
Mapbmd.copypixels (Tilebmd, Rect, New Point (x, y));
}
function Scroll () {
x = x<0? 0: (x> (mapbmd.width-width)? (mapbmd.width-width): x);
y = y<0? 0: (y> (mapbmd.height-height)? (mapbmd.height-height): y);
Bgrect.x = x;
Bgrect.y = y;
Bgbmd.copypixels (Mapbmd, Bgrect, New Point (0, 0));
}
Overall feel. The efficiency is greatly improved. No matter how the picture is enlarged, it can keep flowing smoothly. This method is not only applicable to the tiles mode, if you are the whole map to the map of the process is omitted.