fredag 20. november 2009

Menu and removal

I used the bottem up approch, i started whit making the start of the game a funciton, and then moved on to create a new menu. The new menu was a bit.....

I created the credit menu whit a back button, and kept the background from main menu and removed the rest.
When i wanted to go back to the main menu, the eventlistener needed a parameter, so i could not call it derectly, so i created a function in between that called it and removed credit elements.
This worked well, but a problem whit this method is that the menu music would have restarted every time i went back and forth between the menues.
so I tested to create a background on top of everything, to see if i could click on or see elements from the main menu "and i could not". this way i could create a menu on top of main menu, whitout removing it.

I created a removegame to remove the game elements when the game was lost, and call on the main menu.
i used the code:
while(numChildren > 0)
{
removeChildAt(0)
}
to remove most of the elements, then i used the same method to remove the objects innside the array's "whit pop".
after that i still got a error:
________________________
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
at Script/update()
________________________
it is a hit test that, uses the hit test after the objects are removed.
and i fixet it whit using "break;" after the menu call

I went on to remove the event listeners
removeEventListener(MouseEvent.MOUSE_DOWN, Mouse_down);
but it dident remove the listener, so i used the code "stage." in front of it, because it helped when creating the event listener's "eaven tho i cant think of a logical reason why it shold help" but it did.

Music and sounds

I found free music that was quite good for background music for a game from Derek Audette. and found some sounds from http://www.soundsage.co.uk/free_sfx.html "game over sound". and duck sound and shot sound from http://www.mysoundfx.com/. I edited the duck-, shot- sound and background menu music in sound booth. i edited duck to be only 2 "kwak", shot to be only 1 "shot", and up and down in volume strength for the menu background music.

I imported the sounds to the library, and exported the file to action script. "at first i exported whit the .mp3, and fast discovered that it wasent smart to have it."

mandag 16. november 2009

walk and attack andimation of a creature

I created a new creature because the duck and rabbit dident need more animation"duck has a walk animation that loops, and the rabbit has no animation". I created Alien, walk and attack animation. I had forgotten all about how to make animation and sprite so it took a while whit trail and error"and some help on and off" to make Alien sprite. After that, i had problems coding it. the sprite looped the 2 frames from the sprite, and ignored my calles for to start the walk animation"no error's, the worst kind of flaw". my problem was that i did not call the sprite to spesific alien.
flawed code: anima("Alien_walk", creatureArray[s])
correct code: anima("Alien_walk", creatureArray[s].alien)

Gold gold !


I created gold, hitpoints and life the same time. the first problem i encounterd was that the gold and other numbers dident update. I needed to use a update sentence after updating each variable.

after i finised getting the gold to update properly, then i created the shop. the usage of buttons were straight forward when i got help whit that i needed to use event listener on each button.

AI

creating the AI i started whit getting the creatures to folow the charecter. The problem i got whit it were that i used the code from the school exaple, where they used this.xxxxxxx to point on the last creature created. that were a problem for me because i had a lot of creatures, and they needed to get new directions later. so i created one folow code for each type of creature, i loop trough all the creatures in the array and set a new path for each frame.

the next problem i encounterd were, that the math i was thinking of dident work to get the disdance. but the code i used to find the unit sircle were actualy the distance from point x to point y. whitch is what i needed to use to get the creature to folow the charecter when it came innside a set distance.

after i got that working, then i created the portal and got the creatures to folow it if the charecter is outside its range.

New design and history


I created a more open enviroment, and the creature waves spawn in a random place offcreen to the right. the portal, gold and hitpoints were planned but not implemented before i changed design.

History: you are the last defens for your planet, defend the portal from the invading mythical creatures "duck of doom", "Killer rabbit of Caerbannog" and "alien spawn" that leads to your planet.

i have taken the names "duck of doom" from munchken game, that has taken it from the rpg world. the "Killer rabbit of Caerbannog" is taken from "Monty python and the Holy Grail".


Redesigning hopping osv.


tidlig hadde jeg tenkt en level som brukte noe av det samme level design som enfo's "som vist på bilde" problemet med dette brettdesignet var at hit test koden var så dårlig til å blokere karakteren at jeg valgte å skifte til et åpent område.

på dette designet hadde jeg en veis vegger hvor du kunne gå "ned" fra top nivå uten problemer men ikke opp. jeg hadde også at når du hoppet fra boksene "gule firkantene" så kunne du hoppe opp på top nivået. problemet med disse top levelene var at monstrene måtte også bli blokert av veggene. Og jeg måtte ha laget en path som di måtte ha fulgt.

onsdag 14. oktober 2009

shooting

I started by creating a new child, "the bullet" i created it innside a click function. the problem whit this was that i did not have eany access to it outside the function "i need it in update so that i can get the bullets to fly." so i moved decleration of bullet to the global variable area. that made me able to access bullet outside. next problem was to get it moving the same speed in the right derection, after much testing and failing i turned to math, and found that the "unit circle" was what i needed to find out. so i tested sine and cosine to find the "unit circle" x and y cordinates reletive to the mouse and the charecter. but got wild nubers that i was unable to use, or figure out. so i went over to Pytagoras to find the "unit circle" x and y, this worked perfectly.
code i ended up using:

var a:int = _karakter.y - mouseY;
var b:int = _karakter.x - mouseX;

var total:Number = Math.sqrt(a * a + b * b);
var ferdigx:Number = b / total;
var ferdigy:Number = a / total;

bullet.x -= (ferdigx * 6);
bullet.y -= (ferdigy * 6);

mandag 12. oktober 2009

Coding 2 keybord and sprite

I coded the keybord first outside the update function"the one that updates the screen for each frame" doing this i had problems whit moving in 2 directions at a time. "exs: left and up, which only made the charecter go left or up.. the first key that was hit". and it wold have created a other problem when i fixed the animation."it wold have restarted the animation each time a key was hit". so i moved it to the update function which fixed the movment problem. the sprite was too hard to wrap my head around so i w8 whit it to the walk trough in class. It was no problem's implementing it after that.

mandag 28. september 2009

Coding

The first code was not hard to comprihend, I cuntinued to test out over the case to try to get the mouse to work on the charecter."which failed" I also made the animation to change derection by removing child and adding the other derection. "i know that it is not the way we are suppost to change derection in the next case, but I will need to use that code to remove enemy/minion's that are killed."

søndag 20. september 2009

Flash Animation

The first animation was a walk left and right. sins I use top down graphic's, I only have to make one walk animation that i can code to walk all derections.
because of my top down graphic's animations arnt as clear as the others. I made jump animation by scaling the charecter, so that it seems that it is gaining hight.
when i put the animations together, the animated parts of the walk animation got seperatet from the rest of the body.
I fixed the walk animation by copying the end of the animation which was correct to the front and then entwining again. "copy whit Shift drag and drop and then copy paste to the end".

mandag 7. september 2009

consept

The plan is to create a Top down shooter game, based on a hybrid of Enfos MT, Afterlife survival "Warcraft 3 map's" and Crimson Land.

our first case is to create "design and draw" a main charecter for the game. My charecter is going to be a marine.