ActionScript.org Flash, Flex and ActionScript Resources - http://www.actionscript.org/resources
The mystery of parallel lines
http://www.actionscript.org/resources/articles/1024/1/The-mystery-of-parallel-lines/Page1.html
Alex Nino

My bio... hmmm... what to say... I arrived on this crazy world clearly by mistake on March 81, in a far, far forgotten small town with more problems than a whole nation, close to the pacific ocean in the Colombian territory, it is called Cali. Early I began playing with some gadgets like "telebolito", "intellivision", "Atari", and it was here when I started feeling interested in games and how they are being done but before start programming I've learned to play piano a guitar (I love music, can't live without it). Then I learned some programming languages such pascal with Borland Delphi, and C++ but I have to confess that it was Macromedia Flash who changed my life once we met each other in 98. I'm working with it since it didn't have support of mp3 audio format files, yes the version 3. And then together (Flash and I) started travelling around south america looking for a better job opportunity and professional development than my hometown could offer us at that moment. Special thanks to: Brazil, Costa Rica and Colombia for being a great school. At this moment I'm happily living and paying taxes in London, UK but like a salmon fish one day I will be back to procreate :)

 
By Alex Nino
Published on August 11, 2010
 
This is an algorithm I did for detecting the distance between parallel lines, no matters their positions or rotation. This is a quite simple and light algorithm that can be implemented on any programming language, in my example it was done in Action Script 3 (FP10)

The mystery of parallel lines

There is always extra spare time during the world cup for everyone I think; it seems to me that everybody has more flexible chronograms during the cup and quite tough ones before it; at least it worked always like that with me. For us here in England the world cup finished a bit early but for me personally it carries on till the semi finals (I just been supporting South American teams all the time, hehe).

Just few weeks before the cup I have received an advertisement email speaking about of a competition, a flash game competition with subject as “the biggest flash competition ever”, then I took a quick look on it, and well after I read it what I can say is that it took my attention because of the big amount of people participating on it and of course because of the great prizes. Just by chance during those weeks I’ve been working in an algorithm for snapping objects which works quite well for any kind of shapes (polygons) based on parallel lines. I was working on this algorithm for using it in a modified version of the famous chinese game called Tangram, which it has some modified pieces that makes everything a bit harder when solving puzzles of it. Well as I said it is based on parallel lines, also it is very light in terms of CPU consummation and works perfectly when we want to stick (snap) any kind of polygons with a parallel side facing each other.

Here is a self explanation of how it works:


Here is the algorithm performing as part of this latin Tangram game, The psychometric test.


Guys, this algorithm has many usages and can be reused in different scenarios. Here is the source code in case you don’t want to re-invent the wheel, and also a full explanation of how it was built, watch this video if you’re interested on it.



Anyway, one day after work I was in a pub with an old friend (Andrew Porter) talking about this algorithm, trying to clarify some ideas for participating in the competition without spending too much time and, among pints there was a light at the end of the tunnel for reusing this, making a game a bit more “dynamic” than a tangram. The concept of it was quite simple, reusing the algorithm all, based on shapes (polygons) with parallel sides facing each other all the time. So we made an ore collector picking up some gems around with some magnets, attractions, crazy lasers, flashbacks, etc… and at the end all together was called Blizz in magnetland, don’t ask me why J

And then, once we got a clear idea about what to do and how to do it, we started making the game. It was just before the world cup begins and it took us about 5 weeks for having it all done as it was thought from the very beginning (working only at nights and weekends, it was quite tough and a bit in a rush but nothing that could kill me).

Here is Blizz in magnetland published in Fizzy.com (The competition sponsor), take a look on it and if you like it try to beat my score, I can tell you it’s close to 200.000, hehehe. Beware; this game wasn’t made for those who just like running like a bull shooting around with infinity amount of bullets. This game is not easy and you may have to think for a while before solving some of the levels.

I have done some algorithms during the last years working as a Developer, some of them made in C++ and most of them in Action Script 1, 2 and 3. It is true that It could be easier for me just take one of those and make a game based something almost done rather than starting a new game from the scratch but, you know what, in that case I probably could be wasting my time. I mean, I don’t know if this fizzy competition is one of those where everybody knows in advanced who’s going to be the winner except the participants and in that case I still will have learned a lot of it. If you ask me why I’m participating on it, the answer is so simple: first of all, there is always something new to learn of things like these, new challenges (no matter how small they are) always, always they teach you something new, if they are really new. The whole process from the beginning to the end let you learn more about yourself and the way how you’re facing scripting problems nowadays, persistence, team group, etc. We are all constantly learning and that for me is the spark of living, Evolution! And second of all because of the experience, if I have a voice in something likes this (hi, here I am, this is my proposal, my game), that feeds my soul and the peoples who’s nearby, the rest is extra.

I hope you liked it and this algorithm can be useful for you any further, feel free to ask me about it if you would like to clarify any doubts you have, see you!

Alex Nino - yoambulante.com