Thursday, 14 February 2013

AS3 Flash coding progress

How to make a button

Make a button and call it - btn.

AS3 is very different to AS2, in this case you can not write code directly on a button so you must make a new layer (call it as or actionscript, whatever is easier) and write all the code on this button.

Now make sure the button is called btn and on the as layer (as layer must be the top layer and no objects can be on this layer) write out the following code:


import flash.events.MouseEvent;

btn.addEventListener(MouseEvent.CLICK,pressed1);

function pressed1(e:MouseEvent){
trace('true');
}

AS3 'listens' out for code, in this case it is listening for 'mouse clicks'. On the third line of code the e just before the : does not have to be and e but it is easier to have it, thinking "e stands for event handler".

Tuesday, 12 February 2013

Animation in photoshop CS6 for GLBasic

When making an animation in photoshop CS6 that you plan to put into GLBasic you can not use GIFS, you need to use a PNG.

This can be used to make characters animate on screen.

Make your character in photoshop with a transparent background, then copy that character and make small changes. This can be used for characters running or standing, but in my case I am making a basic bird flying animation for a side scrolling game.

Once you have made the several different versions of the character in different stages of the animation you must make an animation 'strip', so have them placed side by side in order with equal distances apart. You can use the crop tool to make the size of the canvas to fit. They must be exactly the same distance so make sure you have done it right. This is how I did my bird flapping animation:
The next image shows what basic code is needed for the animation: