var clockH = timedate.getHours();

23 10 2008

We’ve got this working now but are yet to fully combine it with other behaviour states. So far we have made it so that between the hours of 19:00 and 0:00 Annie will be asleep and therefore will not be able to be fed, Annie will also become more transparent in its sleeping form.

timedate = new Date();
var clockH = timedate.getHours();
var clockM = timedate.getMinutes();

trace(clockH);

if (clockH >= 19 and clockH <= 23){
speed = 0;
happiness = 50;
_root.cell._alpha=20;
}

Above you can see how little code it is to implement the system clock time. The if statement is just a simple one that stops Annie moving and makes here more transparent between those times. When Annie wakes up its happiness level will be reset back to 50… just like when you wake up and feel normal! Annie doesnt hold daily grudges.

We’ve got the get time function working with both the hours and minutes but are currently only using the hour to influence behaviour. The minutes will be implemented later as part of the “self-feeding” function. The plan is every 10 minutes if Annie hasnt been fed it will go and look at its past food eaten and eat that again, although it wont gain any happiness it will be enough to stay alive for a short while.

Next session we are spending on this we need to get the PHP end and SQL database up and working to get the variables passing through flash to the backend. Yes this will be hard!

Advertisement

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s




Follow

Get every new post delivered to your Inbox.