Thursday, August 26, 2010

Don't We All.


I'm pretty sure everyone of us had an experience of the above.

So the YOG has come to an end. Surprisingly, I found myself glued to the TV all day long watching the games. Especially Table Tennis. A massive congratulations to Isabelle And Rainer for obtaining the Silver medal. And kudos to all athletes for putting in their best. I really hope you guys can improve further and represent Singapore in the future Olympic Games.

So Singapore received 2 Silvers and 5 Bronzes. Which is better than nothing. And as usual, China topped the list.

Anyway, I look forward to watching the London 2012 Games.

On another note, the GERPE/UE allocation results are out and I'm REALLY REALLY happy to get all of my desired electives -- CBC931, HP802 and Astronomy. Thank God, my almost perfect timetable is now finalised.

The first 2 weeks are gonna be relatively short for me as Labs and Tutorials only start from Week 3. So I only have to go to school for 3 days (thanks to my fantastic timetable planning skills). Awesome!!! :D

This semester's gonna be a little lonely for me because right now I have no company for 931 and Astronomy. You're a lone ranger now, Gary.

I guess I'll see my Sis around in school from now on then.

Saturday, August 14, 2010

Different Summers

Taken from thedoghousediaries.com

Met up with the guys from my JC class yesterday. Felt just like old times. And we went shopping together for like the first time ever. Haha. I enjoyed myself though. It was great to see all of them again.

So YOG officially opened last night and the opening ceremony wasn't all that creative and "Wow", but it was generally quite commendable. The coolest part was the spinning torch. And why was Sean Kingston absent??

The new semester is starting real soon. Like a couple days after the Games end. Not entirely looking forward, really. But I know I gotta embrace it. Somehow. Let's just pray and hope that it will be an awesome one, okay? :)

Been playing my keyboard very often, printing new sheet music every now and then. Still trying to figure out how to compose and arrange my own songs. And I haven't been writing any new songs because of the lack of inspiration. Bummer.

Friday, August 13, 2010

How to code a Beat em up

Some of you may remember a long time ago I did write a tutorial on beat em up's, but it was in AS2, and had a few major flaws I picked up on, therefore it was removed.
I figure now is the time to update those tutorials in AS3. This isn't going to be a straightforward making-from-scratch tutorial, rather a guide to the techniques involved. You'll have to do the grunt work yourself- no easy download FLA's for the lazybones here!
-------------------------------------------------
ADVANCED KEY-CAPTURE
-------------------------------------------------

Second only to a real fighting game such as Street Fighter 2, I can't imagine which type of game requires more pinpoint, tight arcade controls than a beat em up. Besides knowing exactly when a key is pressed, after we know what key has been pressed, we will also want to know when it was last pressed (in milliseconds), if it is being held down, and if so for how long.

//////////KEYS
var KEY_UP = Keyboard.UP;

var KEY_DOWN =Keyboard.DOWN;
var KEY_LEFT = Keyboard.LEFT;
var KEY_RIGHT = Keyboard.RIGHT;
var KEY_ATTACK = 87;
var KEY_JUMP = 81;
/////////////////////////////////////////////////////////////////////


First we need to set up some constant variables for the key-codes. As you can see, with the directional controls I'm just using the arrow keys therefore I can use the globals Keyboard.UP etc. KeyCode 87 = "W", KeyCode 81 = "Q".

var keys = new Object();
keys[KEY_UP]={down:false,count:0,held_down:false,timerA:200,timerB:0,timeElapsed:0};
keys[KEY_DOWN]={down:false,count:0,held_down:false, timerA:200,timerB:0,timeElapsed:0};

keys[KEY_LEFT] = {down:false, count:0, held_down:false, timerA:200,timerB:0,timeElapsed:0};

keys[KEY_RIGHT] = {down:false, count:0, held_down:false, timerA:200,timerB:0,timeElapsed:0};

keys[KEY_ATTACK] = {down:false, count:0, held_down:false, timerA:200,timerB:0,timeElapsed:0};

keys[KEY_JUMP] = {down:false, count:0, held_down:false, timerA:200,timerB:0,timeElapsed:0};

Next I've made an Object that contains information on all keys used.
down = Is the key being pressed?
count= How many times has the key listener detected this key being held down?
held_down= er..is actually being held down?
timerA and timer B are used for checking the length of time it's being held down.
timeElapsed= might or might now be useful till later.


stage.addEventListener (KeyboardEvent.KEY_DOWN, downKeys);
stage.addEventListener (KeyboardEvent.KEY_UP, upKeys);

Our keyListeners. What is a listener? Think of it as a function that never stops working until you tell it to. In other words, remove it.




function downKeys (ev:KeyboardEvent)
{
if (keys[ev.keyCode] != undefined)
{
keys[ev.keyCode].down = true;
keys[ev.keyCode].count++;
keys[ev.keyCode].timerA = getTimer() - keys[ev.keyCode].timerB;
keys[ev.keyCode].timerB = getTimer();
}
};

function upKeys (ev:KeyboardEvent)
{
if (keys[ev.keyCode] != undefined)
{
keys[ev.keyCode].down = false;
keys[ev.keyCode].count=0;
keys[ev.keyCode].held_down=false;
}
};

////////////////////////////////////////////////////////////////



downKeys listens for pressed keys, and upKeys listens for unpressed keys.
Okay so every listener triggers an event. Don't worry too much about what that means, anyway the ev:KeyboardEvent part means 'ev' equals the key that has been picked up by the listener. We can use it as a reference into our handy keys object.

if (keys[ev.keyCode] != undefined)

Only proceed if a key has been picked up by the listener.

keys[ev.keyCode].down = true;

This key has been pressed, so set down to true.

keys[ev.keyCode].count++;

Increment variable count- telling us how many times the listener has picked up this key being held. *NOTE* This doesn't work quite as simply as you might think, the AS3 Key Listener is a funny beast- to be explained later.

keys[ev.keyCode].timerA = getTimer() - keys[ev.keyCode].timerB;

getTimer() returns the number of seconds since the movie has been playing. TimerA is the now time. The old time - the timer value it gives us right now. Think about it, you'll get it!

keys[ev.keyCode].timerB = getTimer();
Set timerB, the then time.

So, now I can detect whether a key is being pressed with a line like:

if (keys[KEY_JUMP].down)
{
trace("JUMP has been pressed");
}

This replaces the old AS2 isKeyDown nicely. In fact, it's better isn't it? Not only can we check if the key is down, but we can also get more information about that key.

p.s.Don't forget your libraries at the top.:

import flash.events.KeyboardEvent;

import flash.events.Event;

Monday, August 9, 2010

Shhh... It's A Secret.


I'm so frigging excited that I'm gonna pee in my pants right now. If you bother to play that video, it's definitely Britney's new song played backwards I think. And that's a fierce picture right there! So when I tried to find the up-loader of that video, the name comes up as "Secretney" and this person only has just one video. At the moment. And he/she just joined YouTube 2 days ago.

Honestly, despite Britney's manager denying that Brit has a new album coming up, I guess it's all a mystery promo campaign to build up hype. That YouTube up-loader is probably her marketing team at it. Apparently, her new single premieres this September. Remember that there's gonna be a Britney tribute episode on Glee in September too? How coincidental.

Anyway, I have my hopes up that I can listen to new Britney this year.

Thursday, August 5, 2010

Salt?


Caught one of my most anticipated films of the year with a fellow Angie fan, Pravin today.

Despite poor reviews from critics, I still thought that "Salt" has many interesting and surprising twists, not to mention the awesome stunts and action from the leading lady herself. Not many actresses can pull off a whole action movie by herself. Angelina Jolie is one of the few. Yet, there are some unanswered questions to the story and yes, loopholes. But I guess if you like to watch films like "Bourne" about spies and whatnot, "Salt" may probably be just for you too.

Rating: 4/5

Ok, so I've been holding this back for a few days now until this major blog post, but I finally got myself a keyboard!!! :D It's the latest model from Yamaha and it looks like this:


Nice? It arrives tomorrow and I'm so stoked.

Been watching YouTube clips of people playing Pop Piano/Keyboard and searching sheet music of my favourite songs on the Internet these few days. I'm a happy guy!!! Haha. Music is my passion and nothing beats having your own instrument to play your favourite songs on. Plus I can record my own songs now! I hope I can get some of my written songs recorded into midis so you guys can hear them (if you want to).

Can't wait! :)

Monday, August 2, 2010

'INSANITY II' bidding on FGL

So the game is done, completed 100% and on Flash Game License now awaiting bids. I am in no rush at all to sell, in fact I've half a mind to pimp it out armed only with mochi or cpmstar ads.
I figure if 'THE INSANITY' hit over 1,000,000 players in a half year, that would effectively have gotten me about $1000 in ad revenue by now- and if I could be patient for a few years, that could dd up and add up, who knows? I'd have the cash the sponsors paid for it minus any legal obligation to put someones logo on my game. So we'll see, the only stress for me is the fans out there won't get to see the game till it's been through the bid wars. I'm still adding bits and pieces to the game while it's up there waiting for a pappa.
In the meantime, work starts on the next project. It's time for ACCCCCTTTTIIION! Yes, enough of these dour creepy-crawlie point'n'c*lickers EvilKris is breaking from tradition. Although keeping with the horror theme would make for sound business sense, I'd also like the kiddies to be able to play my games occasionally without their mum's going 'What the bleedin' hell you playing here?- that's bloody disgusting turn it off!'
So the next game will be using my Streets Of Rage Fighter Engine (rewritten in AS3) and will be a simple game kinda similar to the old classic MoonStone albeit shorter and much more hyper- paced. Essentially you'll have a map with about 50 random locations you can 'search', hit any spot and you'll have some enemies to fight and on winning you'll either get a weapon, something to give health recovery, or a hint as to where the final location you're looking for is.
I haven't quite decided on the theme yet but it'll probably be something with barbarians and goblins as I've been playing Oblivion lately. Had a dream I was working for Bethesda the other day.
Tell you what it feels damn nice to get off Insanity 2, summer is here, the babes are on the beach, and my own complication in life is figuring how to get the best suntan.

Sunday, August 1, 2010