The mystery of parallel lines

date: 11 Aug, 2010, actionscript: 3 FP10, complexity: complexity level 4 of 5complexity level 4 of 5complexity level 4 of 5complexity level 4 of 5complexity level 4 of 5, feedback (votes): users score 4.98 of 5 (297 votes)users score 4.98 of 5 (297 votes)users score 4.98 of 5 (297 votes)users score 4.98 of 5 (297 votes)users score 4.98 of 5 (297 votes)

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 (original game manual), The psychometric test.
The psycometric 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 (How to know the distance between parallel lines).



Making the game

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. :)

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.

Blizz in magnetland


About the competition

I have done some algorithms during the last years working as a Developer, some of them made in C++ and most of them in Actionscript 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

date: 03 Jan 2012 - 05:52:16
This looks really interesting. I would like to look through the code but don't have Flash 10 and so can't open the .fla file you have hosted. Would you be able to post just the as3 code please? That way I can have a look through at how it works. Keep up the good work and sharing of this stuff.