Monday, November 30, 2009

Final Post about the Final Case

So, here we are at the end of the road. After about three months. It has been a fun journey, and very educational for my part. I started out not knowing anything about Flash, ActionScript or programming i general. Now I have a nice idea of how things work. By doing all these cases every week i've gathered a lot of info about programming in the ActionScript 3.0 language. From time to time it has been very, very, very frustrating. But I guess that's part of the life of a programmer. And when that time comes, the only thing you can do is sit down before the code and reed through it 'til you find the errors. Well, dunno really if anyone has followed this blog, but if you actually have, I hope it has been worthwhile your time. And maybe learned something yourself. Who knows.. Enough about this. Let me get to the point of this last case. And that is how to put the startmenu, win and game over screens into the game and make the work. In my opinion the most ballbusting and frustrating case, but also a fun one. At least until you run into problems that is ;)

Okay, so let's get down and dirty. I just said that I was going to put all the sreens into the game. But before one takes on such a task you must think of how you want the menus to behave and in how they're stacked. I didn't draw anything, but I made a picture in my head of how I wanted the menu to be. We're talking about a studen making a game in Flash, so the complexity of the menus is rather low. Well, keeping all this is mind, the code itself needs a major overhaulin' because 'til now the game was in the constructor, wich started the game as soon as I pressed Alt+Enter. Now instead of the game staring right off the bat, you want the Start Menu to appear. So basically I had to remove everything I had in the constructor, and make a new function. I called it creatGame, and basically do what the constructor did before. Then I made another new function, that creates the start menu and add eventlisteners for the how to play screen. Then enable the startbutton to run the createGame function. Basically I had to rearrage all my code, and make about 6-7 new functions that intertwined make the menus work. I don't think I'll bother wriing the code here. It'll suffice to say that it was a lot of work. And to my joy I was able to make the start menu and the how to play menu work perfectly. The game over / win screen were more a pain. To make the game over screen work I just added an if in the update function and said that if the players life is zero, or if he falls of the level he dies and the game over screen is to be created, and the game, with all it's objects is to be removed. The win screen on the other had has been everything but cooperative. I almost set it up to work identically to the game over screen, exept that for the win screen to appear the time must run out without the player dying. This oddly enough didn't seem to work. Just the occasional random time from time. I had fellow studens look at my code, I had fellow labassistants look at it. But everything seemed right. Finally I just gave up. My time was running out, and besides turning in the game for evaluation and not flunking the course, I have exams and other stuff to tend to. So I just let it be, 'couse after almost a week of fiddling with that screen I ended up making more bugs. Thankfully I had the code copied before I tried to fix stuff. So, I just hope it's enough to pass. I got everything else down. And I've learned a great deal, so I'm happy with what I've accomplished so far.

Thanks for reading my blog, and maybe I'll keep on writing about school stuff the next semester, who knows.

2 comments:

  1. Det har vært en fornøyelse å lese alle bloggene til klassen deres ;)

    PS: En programmerer kommer over frustrasjonsstadiet og blir bare passiv etter (n*dt)/f år der n er antall år, dt er tiden man bruker på en kodesnutt og f er frustrasjon målt i antall liter cola

    ReplyDelete