Helping the World with KnowledgePosts RSS Comments RSS

Archive for May, 2008

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 230 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 114 times)
  • Open source, have fun with it and link back if you can.

2 responses so far

Pointing Add-on Domain to Existing Domain’s folder 2

In this article, I will guide you through a simple method to point an “add-on” domain (aka alternate domain) to an existing domain’s folder. There is another article about this, but compared to this, it requires more steps. This method, I believe does not work for Cpanel, unless you have somehow tweaked it’s file system. The method described in this article works for the Grid Service hosting account for MediaTemple, but it should work for other similar hosting environments too.

This is what I am attempting to do:
newdomain.com to show olddomain.com/folder and
newdomain.com/whatever-that-follows to show olddomain.com/folder/whatever-that-follows

You are required to have SSH access for this, which is available for (gs) accounts by default.

For the purpose of this article, newdomain.com and olddomain.com are used to explain the steps easily. You are trying to make newdomain.com appear as olddomain.com/folder. Please replace these names with your own.

Step (1)

Add the alternate domain to your account associated with your domain. (Note that domain name takes up to 48 to start working after you changed it’s nameserver.)

Step (2)

Create a directory(folder) under olddomain.com by any means you know. eg. “folder”

Step (3)

Connect to your SSH create a symbolic link from the newdomain.com to the olddomain’s folder you are trying to target by doing the following:

Ussing SSH, browse to your newdomain.com’s folder. In (gs), use the following:

cd domains/newfolder.com

Note:
cd is a command that moves you to another directory.
cd <relative to current dir> to move to that directory.
dir is a command that display all directories and files inside the current directory.
These are standard command line interface commands. Google for more.

Continue…

Now that you are in the newdomain.com folder. Use the following command. The following command assumes that you are using (gs), please modify it accordingly if your file system is structured differently. For (gs) users, replace ###### with own number too.

ln -s /home/######/domains/olddomain.com/html/[path to folder] ./html

Explaination:

ln -s is a command that creates a symbolic link from 1 path to another.
In this case, since we are in the newdomain.com folder, the ./html folder at the end is the sub-directory of the current folder you are in. Which is newdomain.com/html.

./html is linked to /home/######/domains/olddomain.com/html/[path to folder] (An absolute path to the olddomain.com’s folder you want).

More Information

If you are using Cpanel, please refer to the previous article.

For other Mediatemple accounts please refer to their kb article and adapt accordingly to achieve your desired result.

4 responses so far