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.