Case 6 – Programming and Animation of enemy

Posted in Cases on November 17, 2010 by alllifeme

In this “case” we were asked to animate and program a new character that should walk towards the main character all the time.

First of, I made a quick frame by frame animation of a normal blobb (look at case 1 for more information). Then I used the main script to add the character on stage and make it follow the ground (not moving yet).

Then I made the script for the new character by copying from someone else in the group and inputting the names and parameters I wanted.he requre

 

What I have yet to do:

I have done all the requirements, but I want add two more things.

 

1. When the main character is near the enemy, I want a life-bar to slowly shrink and maybe make the main characters alpha decrease with the life-bar.

2.  Make the enemy disappear only after the main character have picked up the coin.

Advertisements

Case 5 – Programming 2

Posted in Cases on November 10, 2010 by alllifeme

So in this “case” we were asked to do at least 3 things. We had to put the character animations into a sprite,  make the character follow the ground and pick something up.

I had already put the character animations into a sprite before, so that part was already done.

So I started out with trying to make my character follow the ground. I managed to do this with some help.

Then I made a coin movie clip in the library and placed it (with actionscript) on my stage. With a hit test, I made it so that when my character hit the coin, it was removed (removeChild).

 

Problems:

I forgot (}) alot of times, taking away some of my time. However, I am better at this now.

Other then that, there where minimal amount of trouble.

 

Extra notes:

This blog post might be a little short because I am a little lazy and time was running out. If I remember something  important, I will add it.

 

Case 4 – Programming 1

Posted in Cases on November 3, 2010 by alllifeme

In this “case” we were asked to create the main scene in our game/entertainment production using the graphic and character we made in the 3 first  cases. But this had to be done by placing them through ActionScript 3.0.
We also had to make the character move  left and right and prevent it from walking out of the screen.

What I did:

Our teacher showed us a a script that we could use as a start for our own game. I used that, changing the names I needed to change.

Here is the code: (Bolded parts are my names and things I added myself)

// InteraktivScene1Main.as – ANI121 – DN 271010
package
{
import flash.display.MovieClip;
import flash.ui.Keyboard;
import flash.events.KeyboardEvent;
import flash.display.BitmapData;

public class AS_tryout_1_Main extends MovieClip
{
private var gress1:gress;
private var karakter:gå_høyre;
private var bakgrunn:Bakgrunn;

//  Bounding box
const L:int = 0;                    // Left
const W:int = 550;                    // Width
const T:int = 0;                    // Top
const H:int = 400;                    // Height
const R:int = L+W;                    // Right
const B:int = T+H;                    // Bottom

public function AS_tryout_1_Main()
{
bakgrunn = new Bakgrunn();
addChild(bakgrunn);
bakgrunn.x = 275;
bakgrunn.y = 200;

gress1 = new gress();
addChild(gress1);
gress1.x = 225;
gress1.y = 340;

karakter = new gå_høyre();
addChild(karakter);
karakter.x = 125;
karakter.y = 380;
karakter.gotoAndStop(1);
karakter.width = 100;
karakter.height = 100;

stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyReleased);
}
public function onKeyPressed(e:KeyboardEvent) : void
{
if (e.keyCode == Keyboard.LEFT && karakter.x > L)
{
karakter.x = karakter.x – 2;
karakter.scaleX = -0.28;
}
else if (e.keyCode == Keyboard.RIGHT && karakter.x < R) {
karakter.x = karakter.x + 2;
karakter.play();
karakter.scaleX = 0.28;
}

}
public function onKeyReleased(e:KeyboardEvent) : void
{
karakter.gotoAndStop(1);
}
}
}

But it didn’t work to my satisfaction, mainly bacause the movement. With this code, when I pressed end held the mouse button, the character moved first the amount of pixles I said it should, then stopped for a half a second or a second, and moved like it should after that. A classmate, Andreas Hellesvik, solved this with boolean variables. But because his script was quite different from the script I had, he let me copy his script. I changed the names I needed for it to work with my graphic/objects, size of the stage, The pace of my characters movement.

This is my script now:

// AS_tryout_Main_2 – JF 117083

package  {

import flash.display.MovieClip;
import flash.ui.Keyboard;
import flash.events.KeyboardEvent;
import flash.events.Event;

public class AS_tryout_Main_2 extends MovieClip {

private var forgrunn:gress;
private var himmel:Bakgrunn;
private var tre:animatedgrass;
private var sky:cloud_1;
private var spritemain:spritemain1;
private var leftKey:Boolean = false
private var rightKey:Boolean = false


const L:int = 0;
const W:int = 550;
const T:int = 0;
const H:int = 400;
const R:int = L+W;
const B:int = T+H;

public function AS_tryout_Main_2() {

himmel = new Bakgrunn();
addChild(himmel);
himmel.x = 275;
himmel.y = 200;


forgrunn = new gress();
addChild(forgrunn);
forgrunn.x = 225;
forgrunn.y = 340;


sky = new cloud_1();
addChild(sky);
sky.x = 300;
sky.y = 50;


tre = new animatedgrass();
addChild(tre);
tre.x = 400;
tre.y = 330;


spritemain = new spritemain1();
addChild(spritemain);
spritemain.x = 130;
spritemain.y = 370;
spritemain.height = 100;
spritemain.width = 100;
spritemain.gotoAndStop(1);

stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPressed);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyReleased);
stage.addEventListener(Event.ENTER_FRAME, onFrameLoop);
}

public function onFrameLoop(e:Event) : void
{

sky.x = sky.x – 1;
run();
}

public function onKeyPressed(e:KeyboardEvent) : void
{

if (e.keyCode == Keyboard.LEFT) {

leftKey = true;
}


else if (e.keyCode == Keyboard.RIGHT) {

rightKey = true ;
}
}
public function onKeyReleased(e:KeyboardEvent) : void {

if(e.keyCode == Keyboard.LEFT) {

leftKey = false;
spritemain.gotoAndStop(1)
}

if(e.keyCode == Keyboard.RIGHT) {

rightKey = false;
spritemain.gotoAndStop(1)
}
}

public function run() : void
{

if(leftKey == true) {

spritemain.x-=3;
spritemain.scaleX=-0.28;
spritemain.gotoAndStop(2);
}

if(spritemain.x<15){spritemain.x+=3}
if(rightKey == true) {

spritemain.x+=3;
spritemain.scaleX=0.28;
spritemain.gotoAndStop(2);
}

if(spritemain.x>535)
{
spritemain.x-=3;
}

}

}

}

 

What I have learned:
I have learned that addChild is used to add something to the stage. I have learned about sprites, that it is a great way to add the different movements so that the overall size of the file is smaller. And a great way to easily go to the movements when needed.

I already knew some scripting before I began this, but I still have dificulty understanding everything when put together.

Case 3 – Background

Posted in Cases on September 27, 2010 by alllifeme

In case 3 we were asked to make three animated “backgrounds/stages”. They should have at least a background, a main ground where the hero would walk, and a foreground.

1. My first stage is a  (badly drawn) sky place. The background is the sun and the sky. The main ground is a simple squared walkway with a gradient. The foreground is white flowers that look like mushrooms.

2. My next stage a jungle. The foreground is lianas. The main ground is a simple brown shape that I made with the brush tool. the background is a picture I took in week 41 at home.

3. My last stage is a grassy field. The background is mountains. Another background is the sky. The sky is a simple gradient. Blue and red. The main ground is the grassy field. It has a flower with a fly on it.

Case 2 – Animation

Posted in Cases with tags , , , , , , , , , , , , , , , , , on September 18, 2010 by alllifeme

So case 2 is quite straight forward. We need to animate the characters we made in case 1. They need to have a “go left” animation, a “go right” animation, a jumping animation and a resting animation.

I have made the  right and left walk animation so far. They are made with tweening.

Walking Cycle

I have animated the hair, so it looks like it is flapping in the wind. I have animated the eyes, so it blinks.

For the eyes, I used normal frame by frame animation with very long pauses, and some not so very long, making him blink more “normally” instead of a generic blink every second or two.

For the hair, I used shape tweening. This worked out, but it does look a little crazy.

The arms, legs and body move with motion tweening. Everything but the feets are in a movie clip. (The walk animation itself is a movie clip, but inside that movie clip, the entire rest of the body is in another movie clip, so I could animate the body going up and down while walking)


Jumping Cycle

The eyes, body, head and hair is the same as the walk cycle, as well as the right leg and arm.

The entire upper body, excluding the arm,  have its own movieclip that have a motion tween. The right arm and the right leg have each their own movieclip and motion tween to follow the body as it jumps.
Rest Cycle

The rest cycle use the same layout as the jump cycle, but the only movement is a simple “back and forward” motion done with motion tweening.

Case 1 – Ideas

Posted in Cases on September 8, 2010 by alllifeme

Welcome to my Caseblogg!

As a part of my higher education at Hedemark University – campus Hamar, we have these assignments where each case is a step towards a finished product. In this case a game or interactive animation.

Case 1 is the ideas, sketches and history behind it (The story).

At this point, I have ideas on what the playable character should like like, how the overall design of the enemies are and some of the story.

The Playable character:

Look at the bottom, I am now using the backup hero.

The playbe character is a blue and furry creature with long neck and animalistic features (mostly his face). He has long arms and fingers. His body is slim but not skinny. His legs are about half the length of the arms.

Here is a simple line-art and a sketch of him: (If I was better at drawing, he would like alot more badass and alot more like an actual “human/animal” mix)

Story:

His name is Munai, and is a citizen from the magnificent city of Masali Teso. For ages, this city have been without worries and flourished.  However, at the turn of the century, a tribe of blobbs have started attacking the city. It is your job to attack them and defeat their maker…

Enemies:

The blobbs!

The Blobbs are snot from all kinds of people in society. However the main design are the same, with minor details on them (Like a mohawk on the punker blobb, a helmet on the warrior blobb, etc.)

Fodder Blobb

Normal blobb. To kill it, either jump on it or stab it. It has 1 Life.

Punker Blobb

Snot from punkers and emos. Beware, do not jump on them, you will lose one life. Have 1 life. Needs to be stabbed to kill.

Female Blobb

Snot from females. Leech onto the hero and absorb life slowly. Stab it or jump in it twice to kill it. Often more then one around the same location. Have 1 life.

Martial Art Blobb

Snot from martial artists. Can block your attack, must be stabbed from behind or jumped on to kill. Have 2 lives.

Warrior Blobb

Snot from warriors. Can not attack its head, must stab it. Have 5 lives.

Backup Idea:

I might switch the hero to another design, but keeping the story. I will add the backup hero here if I deside to go with it.

This is my backup hero:

Attacks:

– Jumping on the enemies.
– Punching them.