Wednesday, April 23, 2008

Social timelines: Timetoast released



Using Adobe Flex as front end and Ruby on Rails as backend technology, here it comes Timetoast, a new web 2.0 site that you should keep an eye on.
From their press room:
LONDON, England - April 22, 2008 - Timetoast, the new web-based timeline
creation application, launches it’s service to the public today.
Timetoast.com is a web application that allows people to create interactive
timelines, which they can share anywhere on the web. Anyone can join and
start creating and sharing their own timelines, all they need is a valid email
address. It's also completely free.
Timetoast.com was built on top of powerful open-source frameworks and technologies
such as Ruby on Rails, MySQL and Adobe Flex


You don't even need to sign-up if in case you want to check the public timelines. However, you would need to fill in a small form (only 4 fields) to become a member and start creating your own time-lines.
By default your timelines will be saved as "drafts" that later on you can change this status into "public" allowing the world to see them.
One of the cool features is that there's RSS feeds everywhere! even each timeline has its own feed; this is great if in case you want to create a mash-up application or let's say widgets showing these data...

So, if in case you want to track a project, share the story of your life, your dog, your relationship... or tell others what you know about your favourite artist using a timeline, go and sign-up.

Salut!

Piranha-Loca-timeline

Tuesday, April 15, 2008

Tweener for games: Countdown

Last week I came back from holidays, I was back in my home country after almost 6 years since I left, that's why I couldn't update the blog...
Anyway, as mentioned before, I'll be writing some tutorials on how to use Tweener for games development, however, take into account that the code can be used on other applications as well...
The first "tutorial" is

Creating a countdown using Tweener

From my point of view, adding a countdown to a game helps to improve the playability as the user feels more challenged to finish certain task.
After reading Arthur Debert's Tweener Tips, I got the idea on developing further his "Poor's man timer":

Tweener.addTween(this, {time:0.3, onComplete: myFunction});

Right, so if we put it into a function, then we have:


var timeleft : Number = 30;

function tweenDown() : Void
{
trace(timeleft);
timeleft--;
Tweener.addTween(this, {time:1, onComplete:tweenDown});
}

tweenDown();


First we declare a variable called "timeleft" and set it to 30, so we will count down from 30 seconds to 0.
The function tweenDown() traces the updated "timeleft", decreases the timeleft value by one and using tweener it calls itself every second thanks to the onComplete parameter.

If we tide up a bit, we can add another function to trace the updated value of timeleft, then we have something like:

var timeleft : Number = 30;

function showTimeleft() : Void
{
trace(timeleft);
}

function tweenDown() : Void
{
timeleft--;
Tweener.addTween(this, {time:1, onUpdate:showTimeleft, onComplete:tweenDown});
}

tweenDown();


The function showTimeLeft() will trace the updated value of timeleft thanks to the parameter onUpdate and this allow us to do something else instead of only tracing; we can add a textfield (with instance name txtTime) to show us the updated timeleft value and the updated script would be:

var timeleft : Number = 30;

function showTimeleft() : Number
{
return txtTime.text = timeleft;
}

function tweenDown() : Void
{
Tweener.addTween(this, {time:1, onUpdate:showTimeleft, onComplete:tweenDown});
}
tweenDown();


Now, the problem is that when the countdown reaches 0, it doesn't stop!
so we can add another function to check if there's any "timeleft" and if there isn't, then do something else. The final script for a simple countdown is:

import caurina.transitions.Tweener;

var timeleft : Number = 30;

function showTimeleft() : Number
{
return txtTime.text = timeleft;
}

function tweenDown() : Void
{
Tweener.addTween(this, {time:1, onUpdate:showTimeleft, onComplete:countDown});
}

function countDown() : Void
{
if(timeleft > 0){
timeleft--;
tweenDown();
} else {
trace("GAME OVER!");
Tweener.removeAllTweens();
}
}

tweenDown();


and this is the example:




Salut!