Thursday, May 15, 2008

Tweener for games: Updating Amounts

Following up on the Tweener for games tutorials, this time we will see how to update amounts gradually using Tweener to make them look nice & smooth.

As an example we can see my game GAIA - Guess Who? where the score is updated gradually instead of in one step (immediately) adding more to the user's experience and making the game more playable and enjoyable. Trust me, these little details can make a difference ;)

Update amounts gradually using Tweener:
What I've got on stage is a dynamic textfield with instance name "txtScore".
To give it a value, we declare a variable called myScore:


var myScore : Number = 100;
txtScore.text = myScore;

If you run the movie, your txtScore shows 100.
Nothing exiting I know... :P

Because we need to update this amount when a certain event happens, then we add a button, we will call it mcAddBonus.
Now let's use tweener to update the score adding a 50 points bonus:

import caurina.transitions.Tweener;

var myScore : Number = 100;
txtScore.text = myScore;

mcAddBonus.onRelease = function() : Void
{
Tweener.addTween(this._parent, {myScore:myScore + 50, time:1, onComplete:function() { txtScore.text = Math.round(myScore); }});
}


Testing the movie, whenever we press our button after a second myScore updates by 50.
Still nothing special :(
but, how about if we use the tweener onUpdate parameter instead of onComplete?
the onComplete only updates our score when the tween has finished but as we saw on the previous example, onUpdate updates the value gradually before the tween finishes.
Let's change the code:

import caurina.transitions.Tweener;

var myScore : Number = 100;
txtScore.text = myScore;

mcAddBonus.onRelease = function() : Void
{
Tweener.addTween(this._parent, {myScore:myScore + 50, time:1, onUpdate:function() { txtScore.text = Math.round(myScore); }});
}



Sweet!
I must say I love Tweener, is a great tool :)
and this is the example:






salut!

Saturday, May 10, 2008

Flash Games Contest: 5th place

Gaia - Guess Who?
To be honest I was a bit too positive about this one and I was expecting to get one of the first 3 prizes, however, there were 200+ games and many of them were really good, so 5th place is not bad at all ;)

The contest: MochiAds & Gaia Online - Become a Rock Star.

Actually there were two categories:
- Rock Star Winners
- Gaia Audience Prizes

and my game Gaia - Guess Who? won the 5th place of the Gaia Audience Prizes category.

I must say my game Gaia - Guess Who? is not the best but I was positive because I actually participated with 3 games altogether:
- Gaia - Guess Who?
- Save the Ants
- Pawel & the Teutonic Castle
Anyway, I'm really happy I've won a prize on this contest :)

For more info check out the "Become a Rock Star" Flash Game Contest winners' page.

salut!

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!

Wednesday, March 19, 2008

Best Practices? well... ok...

On my previous post I said I would avoid using "best practices" when developing my own stuff; trust me that this thing of people stealing code really annoys me but I've decided to change my tactic.

The thing is, you never know when you are going to work again on a project as for example, I want to update the Flash Date Calendar Widget I built long time ago, and even though the file "is not that bad" still is a bit messy and makes my work a bit harder; now imagine, if I completely avoid doing the things in "the right" way, any update in the future will be a nightmare!

To avoid feeling bad about the "code thieves", what I will do is to keep on writing tutorials and to show how easy is to use my secret weapon: TWEENER.
These days I'll put together a series of tutorials on how I use tweener to do certain tasks like updating score, shooting, updating life, etcetera.

Salut!

Monday, March 17, 2008

Best Practices? no thanks...



Generally speaking, best practices are good. But what are best practices? from the Wikipedia:

...Best practices can also be defined as the most efficient (least amount of effort) and effective (best results) way of accomplishing a task, based on repeatable procedures that have proven themselves over time for large numbers of people.


Right, so in theory we want to accomplish a task in the most efficient way and I absolutely agree with that not only applied on programming but in other things we do in life. Now, if we are talking about programming and more specifically, programming ActionScript for Games, then the thing changes a bit and mostly will depend on one factor: are you developing as part of a team?
if the answer is no, and you are definitely the only one working on certain game (or any application in general), then my advice is: "AVOID BEST PRACTICES".

and no, I'm not mad (well, not that much...) but I've opted for not using best practices because:

- The number of flash developers is growing (this is great!)
- The number of people learning actionscript is growing (is fantastic!)

ok, both are actually good things, but...

- the more people learning actionscript, the more people use the ever growing number of evil tools to decompile your applications.

And that's the thing, I've been working long hours on a specific script, using my knowledge, my brain, studying, experimenting, testing, debugging... and all that just for a bandit that will come and steal all the hard work to monetize with it?
NO THANKS!

the problem is, these days is very easy to monetize with your games, both using MochiAds and getting sponsors so there's a whole lot of thieves out there waiting for you to release a game just to steal some pieces of your code (if not all of it...)

Anyway, at the end of the day, they will manage to do it but I want to make their work not that easy, so from now on, I'll start using something like alphanumeric properties and methods so a code thieve will find only
var s48758wikk49 : String = "alajsktha"
that in fact it should be something like
var score : Number = 567;
and forget about best practices... :D
will be fun!

and of course, I'm seriously thinking about buying SWF Encript from Amayeta, I think any serious flash developer should have a copy of it.

ADVICE: Protect your code!

Salut!

Wednesday, March 12, 2008

Overload Studios website update


First of all, I still haven't got internet at home. Why? well, whenever my girlfriend allows me to turn on the computer, I don't want to spend my time checking my email, forums, blogs, etcetera; I prefer to work! :)
These days I've been working on my games, updating old games and creating new ones and to promote them, I have updated my old website Overload Studios.
Last time I updated the site was back in 2003! almost 5 years ago, so definitely I had to do something about it and do it fast so that's what I did:

Homepage:
- Took a component from AFComponents.
- Followed a tutorial in Spanish from Infected-FX (Gracias wey!)
- Added some of my widgets
- Added google ads, analytics, etc.
and voila!

Games Pages:
- Games and other swf files embedded using swfobject
- Added some of my widgets
- Added google ads, analytics, etc.
and bingo!

my site has many more visits now; definitely a clean, clear and fresh design helps you to get more visits :)
Of course I would love to have something more complex, having a rating system, allowing users to leave comments (that I can use as feedback to improve my games...) etcetera but at least the first step is done ;)

salut!