So Cool in Bratislava and Cracovia

Welcome back to everyone,
I spent fantastic days in Slovakia, Czech Republic and Poland!
I hope you all had a good holdays this year..
I falled in love with this two cities and I’m sure I will come back as soon as possible for a week-end or holidays.
Weather wass very cold (-10° C), it’s always snowing, but people (girls expecially), beer and food are superbs!
We’ve drunk and eat everyday in every hour 🙂

P.S. I met a fantastic girl in Bratislava, in the Café Studio Club! I have to learn Slovakian language now.. the problem is that it’s not OOP 😉

A PHP domxml class in flash style!

Some days ago Daniele, a friend of mine, point my attention to an opensource project hosted on sourceforge that is very interesting for PHP/Flash guys 🙂
This module permit to do an xml parsing, in PHP, using a dom xml in the same way we already do in flash.

Here a little example i made using this class:

<?
// include the php module
include('lib.xml.inc.php');
// load an external xml source
$test = new XML('test.xml');

// make a simple parsing, in AS style ;)
$childs = $test->firstChild->childNodes;
for($a = 0; $a < count($childs); $a++){	
echo "nodeName " . $childs[$a]->nodeName . "<br />";	
echo "nodeValue " . $childs[$a]->firstChild->nodeValue . "<br />";
}
?>

as you can see, we’re already familiar with firstChild, nodeName, nodeValue… etc..
I always hate the PHP SAX parser, and always always prefer a dom xml parser, much more simple to create and to read.

A* PathFinder for Flash

Use the A* algorithm to create a path finder for your flash games.
The A* can be summarized as:

    setup the openlist (an array)
    setup the closedlist (an array)
    push the starting node to the open list (node is a square in our grid)
    while the openlist is not empty
        Look for the lowest 'f' cost node on the open list and pop from the openlist and name it 'current'
        if the current node is the goal then we found the solution, exit the while loop
        for each of the node adjacent to the current node (8 is we allow diagonal movement)
        set the parent of this adjacent to 'current'
                if a node with the same position as the adjacent node is in the open list /
                and its 'f' is lower than the node adjacent
                        then skip current adjacent node
                if a node with the same position is in closedlist /
                and its 'f' is lower
                        then skip current adjacent node
                otherwise push the current node to the open list
                remove occurences of adjacent node from OPEN and CLOSED list
                Add adjacent node to the OPEN list
        end for
        add the current node to the closed list
    end while

Read the article on my wiki
View the working example