Helping the World with KnowledgePosts RSS Comments RSS

Archive for the Tag 'actionscript 2'

Flash Isometric Map Maker - Oasis

This is a flash isometric map maker I made almost 2 years ago while I was still quite a noob, so the programming might suck a little although it is quite advance. Due to lack of planning, the functions are all over the place so even I am confused after not looking at it for such a long time. Everything is self-learned by the way :)

It was uploaded before, but the server went down along with all the data, so I am reuploading it now. I uploaded it because I figured if it just sat in my hard disk it would just err…. sit there. So, if I upload it maybe someone interested in it can learn something from it or make good use of it. (That is if you figure it out somehow) Please post any comments if you do :D

If you understand the concepts of this map maker, you could probably make a better one yourself because you will learn what is possible with flash.

I will upload a demo later, too lazy now.

  • Actionscript 2
  • Flash 8
  • Isometric
  • Saving and loading map using XML and PHP into text files
  • OOP

Some documentation I attempt to write:

Introduction

Everything is contained in the “world instance” sitting in the stage. The movie clip name is called worldMC and it’s functions are in gameWorld.as. If you understand OOP in flash, this means that the constructor in gameWorld.as which is gameWorld() would run as soon as the flash is loaded. Okay, the init() function runs as well, but I don’t remember where did I call it.

The engine is able to read and generate XML and since flash alone cannot write files, PHP is used to save it to the hard disk. You could save it to a database if you know PHP. Oh and by the way if you need a hosting with PHP and MySQL, I can provide it.

The engine draws the isometric map using lines and fills that is inbuilt in flash. You then apply the “texture” AKA map objects onto it. These objects are in .swf formats within the texture.zip.

Installation

Just extract everything into a folder then open the html file to view it. Extract textures.zip into the same folder as well unless you want to put it in a separate folder and modify the path to load from it. I did not include the php files to save it, maybe later.

XML generation and loading

The current XML format is not very human-friendly or valid. If you change the format of the XML generated, you must also change the way it is loaded, which is the load_map function.
XML generation function - generateMapXML(map) in map_maker.as
XML loading function - load_map(url) in map.as

The text commands

This is basically the /load, /save and /texture commands. The function that deals with this is the command(msg:String) function found in map_maker.as line 57.

  1. /load <xml_file_name> would load the file into the map
  2. /save <xml_file_name> would save it if you are running php on the server(mapper.php is the file that does the writing of the xml file to the hard disk).
  3. /texture <swf_file_name> would load the swf “texture” as your current texture. To apply that texture, select a tile by clicking on it and click on apply texture.

Map Size

The map size is controlled by mapInit() function in map.as

Download

Download >> Oasis - Flash Isometric Map Maker (Downloaded 304 times)

It is recommended that you bookmark this page for further reference or updates.

No responses yet

Flash Graph Application

  • Actionscript 2
  • Flash 8
  • Open source
  • Demo below

Grapher is a flash graph application programmed with actionscript 2.0 in OOP. The basic version 1.0 allows you adjust the axis and plot points in the class <world.as>. There is not much you can control with the output now except to mouse over the points to show the coordinates and drag them to move the points around.

I have a few features in mind - such as calculating the angles, areas and distances between points making it more useful for those who are learning geometry. And I could also add a GUI to add, remove and join points.

Demo:

Drag the points around.

There are currently 3 classes:

  1. world.as - Which in the stage contains everything except the background. It controls the axis and adds and stores the points and lines. There is a tick() function which executes every frame (24 FPS) in every iteration it loops through the points and executes each point’s tick().
  2. point.as - This is the class of the point movie clip. The constructor function creates all the interaction function with the user’s mouse such as dragging and the pop up tooltip when user rolls over it. This class also draws the line, but stores as a child of world.as’s line container movie clip. The line is drawn to the previous point by calculating the relative coordinate from this point to the previous.
  3. Tooltip.as - Is a modified class taken from http://theflashblog.com/?p=16. I added the function update_text(theText) in order to update the text on the tool tip. This is because by giving the user the ability to move the point, the text must be updated.

Within the point class’s tick() function, there are 3 functions that run every iteration, the update_tooltip() which updates the text in the tooltip, the update_line() which redraws the line and the update_text() which updates the coordinates (It is hidden by line 41 in the point class, you can un-hide it by commenting out that line.

Download:

  • Download >> Flash Grapher (Downloaded 172 times)
  • Open source, have fun with it and link back if you can.

2 responses so far