Wednesday, June 11, 2008

Character elastic movement


Flash game characters doesn’t have to move only in standard way, press left arrow key to move left, right arrow key to move right, space to jump etc. In this new flash game, main character (hero) will move differently. Hero will be dragable and on click, he will perform elastic move. Start position and destination position will be symmetrical in relation to Stage center. Enemy can be destroyed only if mouse is not pressed, otherwise, hero health will decrease.

Now, code. First we import related classes:

import mx.transitions.Tween;
import mx.transitions.easing.*;

We need to define simple onPress, onReleaseOutside and onRelease methods for movie clip of our hero, mcHero. Method onRelease has two functions, findSimPoint() and doTween(). It is obvious that findSimPoint() calculates symmetrical point of hero x and y in relation to Stage center. DoTween(), well, performs the tween! Code comes with comments.


Download hero.fla




Posted by flanture at 15:48:03 | Permanent Link | Comments (0) |

Thursday, January 03, 2008

Flash Lite 3 enabled mobile phones


Flash Lite 3 Developers Edition is available for some time now for download. This is standalone player for testing SWF files published as Flash Lite 3. Some features are not available like wallpapers, screensavers, web browser. First phones with pre-installed player will be available in first quarter of 2008.

Now, FL3 DE has been downloaded and succesfully installed on these devices: N95, N95-NA, N93, N91, N80, E65, Nokia 6110 Navigator, E62, Nokia 6120c, Nokia 3250, E90, N75 (some issues), N82, E61. This list have been collected from Adobe Forums. If you installed on other device, tell us about it.

Did I mentioned that download is free, no need for IMEI number submitting?
Posted by flanture at 01:56:49 | Permanent Link | Comments (1) |

Tuesday, November 27, 2007

How to shuffle deck of cards


When making some Flash game there is sometimes need for Arrays manipulation. For example if you make game with cards, you want to find a way how to shuffle set of 52 cards. Let's say your array is:

a = Array("1h", "2h", ..., "14h", ..., "14d");

now, you can use next function to shuffle your cards array:

1.function shuffle( b:Array ) : Array{
2.     var temp:Array = new Array();
3.     var templen:Number;
4.     var take:Number;
5.     while (b.length > 0) {
6.         take = Math.floor(Math.random()*b.length);
7.         templen = temp.push(b[take]);
8.         b.splice(take,1);
9.     }
10.   return temp;
11.}


What this code means? I hope it is clear I only have to explain lines in while loop, because everything else is easy to understand. So, while loop will work until there are elements in start array, and do remember that we take one element from that array in every pass. With line 6 we choose randomly one element of start array. Then in 7, we push that element in first empty place in result array and than in line 8, we exclude same element from start array. In every while loop pass, start array is shorter for 1 element and result array is longer for 1 element. Since we choose element randomly in the end function returns shuffled array. Simply as that.

You can test this function with this code:

trace(a);
trace(a.length);

function onMouseUp() {
    var c:Array = new Array();
    c = shuffle(a);
    trace(c);
}


Download this function and few more here.
Enjoy!

Posted by flanture at 03:21:34 | Permanent Link | Comments (0) |

Wednesday, November 21, 2007

Charles Darwin's Beagle


Recently I spent several hours traveling by bus, without any source of fun except my Nokia mobile phone. I realized that I have to do something about it for such future trips. I enjoy reading, but carrying books around is not always an option.

Solution is mobile book or mBook, which is small Flash lite file I can transfer to my mobile phone. There are limitations, I know, but I'm not looking for perfection just something that can do the trick.

Check out my example - Charles Darwin's The Voyage of the Beagle preface. download here.

File is only 9 kb and has 14 pages. File dimensions are 176 x 208. First screen is "jump page" where you can enter page number where you wanna start reading. Press right button, then OK and enter number of page and then number 5 for jump. Navigation is done by pressing buttons up and down.

Now this mBook is just small experiment, but it allows any text book to be converted in a form that is suitable for reading on mobile devices that supports Flash Player. So, what should I read next?
Posted by flanture at 04:20:27 | Permanent Link | Comments (0) |

Saturday, June 23, 2007

Small update


Small update to Sparta Defender, now v0.13. First, I added points won movie clip that let's you know if you killed Persian shield or you missed it. Second, I introduced time limit. Now you have 3 minutes to kill 300 points or 60 Persians or Sparta fill fall.

Download Sparta Defender v0.13
Posted by flanture at 19:39:32 | Permanent Link | Comments (0) |

Wednesday, June 20, 2007

Sparta Defender v0.11




My simple "space shooter" v0.8 surprized me few days ago by becoming "Sparta defender" v0.11 ! I have changed main character and enemies, added background and solved timeline issue.

You have to move mouse left and right and destroy all those Persians as soon as possible. At start they come to you slowly, but their speed is changing fast. You goal is to get 300 points.

Game has 56 lines of code. I have been using code I wrote earlier for main character and you can read that post here .

Download game swf and source code Sparta .

If you have any question about code, please feel free to ask.
Enjoy !
Posted by flanture at 23:50:34 | Permanent Link | Comments (0) |

Thursday, June 14, 2007

Emanuele Feronato rocks !

 

Emanuele Feronato and his website really rocks. For every Flash Game Developer wannabe this is never ending source of useful informations about making games in Flash. More suitable for beginers, but well explained, code everywhere , samples and stuff.

 

I wish I could have more free time to explore it more. Nice work Emanuele !

Posted by flanture at 16:48:54 | Permanent Link | Comments (0) |

Sunday, May 13, 2007

fav apollo apps

There are still small number of apollo applications out there. Some new websites like apolloapps.com and apollohunter.com are trying to collect all those new air files in one place.

I have tried so far about 20 apollo apps and one game. Many are still betas, but some already have nice functions. I have prepared something for those who want to try apollo for first time.
I have made small collection of apollo applications (various authors). All apps are free to use. There are 10 apps inside zip file and complete collection is only 3 Mb. Offcourse, you'll need apollo runtime.

My favorite ones are fresh, lookup and apollobook. This is list of apollo applications you will download:

ApolloTwitter.air 268 kb
Ascension-0.6.air 425 kb
Fresh.air 525 kb
Lookup.air 322 kb
Tweetr.air 263 kb
YoutubePlayer.air 286 kb
Apollobook.air 206 kb
ASCodeAnalyzer.air 295 kb
ProjectTracker.air 351 kb
MyUrlShortener.air 241 kb
===========================
All 3.1 Mb
===========================


Enjoy !
DOWNLOAD


Monetize Your Site
Best Money Makers


Get Reviewed by this blog for $40 at ReviewMe!
Posted by flanture at 15:42:16 | Permanent Link | Comments (2) |