Thursday 30 August 2012

Book flipping

Today I spent a little bit of time working on getting my book for the instructions page up and running. I had to finish the final book section animation and then copy and reverse all the page flips so the pages can be flipped both back and forth. I then created a book class that contains all the functionality for the book so on the instructions page all I have to do is create it and call it's setUp function. I'm quite happy with how the coding went, I was able to sit down and get almost all the coding done without needing to test it much, the only thing I forgot to add the first time were if statements checking to make sure that when you went to move forward you weren't on the last page in that section, or when you went to move back that you weren't on the first page of that section. I'll come back and fill in the instructions once I more of the game completed. I built how it changes pages and sections so adding more of either wouldn't be too much work, if I want another section I'll have to do a little more rough drawing for page and section flipping.

Wednesday 29 August 2012

Mini me

I've been working on getting the mousetraps to work, killing a rat if it's ready when the rat walks past it. I also have it so once the trap has been released, a counter starts that doesn't allow the trap to be rearmed until a given amount of time has passed, which can be reduced by upgrading the mouse trap speed stat. Another thing that I worked on is getting it so the hit detection area for the garbage isn't based upon hard-coded numbers, but instead based upon where I place the top and right hit points, the bottom and left are based off the origin. This allowed me to remove the generic background I had been using as the basic hit box, and instead have the invisible hit box suited for each different shaped garbage. I also scaled down the size of just about everything, from the garbage and mousetrap, to the rubbish and rats. Lastly I've added in a background to the level that changes depending on which level the user is currently playing.


This is a video taken before most of the work was done described in this post.


This is a rough animation I did for the instructions book.

Friday 24 August 2012

SO MANY RATS

So I've made some major strides with my Rubbish game over the past few days. I had a lovely fatal error that was causing my flash program to crash whenever it encountered the problem, the really annoying part was it was randomly happening and since it was crashing flash I couldn't even read the traces to find out where the error was located.

Luckily I had time and process of elimination by my side and after commenting out large, then progressively smaller chunks of code, I was able to find where the problem was located....i can only assume. The strange part was it had to do with my garbage spawning however the problem shouldn't have been one. To decide wither the garbage that was spawned was going to be good or dangerous I had a random number chosen, 1 or 2, using my randomNumber function. Then if the number was 1 I would make my isBad Boolean false, else i would make it true, I would then pass this along to my garbage class and it would use the Boolean to choose from the correct array of items. This should mean even if for some strange reason the randomNumber function was wrong and I got a number that wasn't 1 or 2, a garbage would still be created. If I always spawned a good garbage, flash wouldn't crash, and if I always spawned a bad garbage flash wouldn't crash, I just commented out the if statements and the randomNumber generation and hard coded in the true or flash in the setUp function of my garbage.

I was finally able to fix my problem by simply having the same code, but in my garbage class so the playScreen class would just spawn a garbage and then the garbage would figure out if it was good or bad, using the same method I was trying to use on the play screen. For some reason I haven't had a crash since even though it shouldn't make a difference wither I do the randomNumber and Boolean assignment inside garbage or outside and pass it in.

I was able to get rats added, with different amounts and types spawning depending on the current level the player is on. The rats move forwards and can only be killed if the rubbish jumps and falls on them. If a rat makes it all the way to your garbage pile alive, it takes the last item you caught, along with the number of points it's worth and runs off screen. Soon I'll be able to add a few more btns to the level select screen and I'll have my basic first five levels complete.

Friday 17 August 2012

Let the trash collecting begin!

Over the past few days I've finished up the shop screen for now, adding in a pop-up window for buying your lives, stats and equipment. This shows what your saving if you've bought the bargaining chip and what the total cost is going to be. I've also made quite a lot or progress on the main game, the rubbish can now jump, can only move between two boundaries that I've set up, and he also has has health. Good and bad garbage falls from the top of the screen, so many good garbage fall on each different level, and the number of bad garbage that can fall is based upon that number. It currently counts down the number of good garbage left to fall, the amount you've caught and the ones you missed. Also when you get hit by a bad garbage your health goes down.

The level is finished once you either get hit and lose your last health, or once you've collected the last good garbage/let it fall to the ground. If you died or didn't meet the required good garbage points/ catches for that level then it only shows a 'try again' option and a 'level select' option, other wise if you've beaten the level then it shows a 'shop' and 'inventory' button as well.

I've also gotten some rough art done for the good and bad garbage, so it's easier to tell whats dropping while I'm building the game.

I'll update with pictures later.




Friday 10 August 2012

Life's really just garbage

Today I worked on the lives page in the shop. I ended up adding several more stat boxes, one for current lives, cost of new lives your going to buy and the percentage saved with your bargaining chip. I also added a button for purchasing your new lives, along with several constraints. One constraint is the fact that you can't select more new lives then you currently have the garbage points to buy, and you each new life price is based upon the current number of lives you have plus the current number of new lives your trying to buy, this way someone won't just stock up on 100 lives at the start, it'll cost far too much, and the less lives they have 'floating' while they play the more points they'll have for buying stat upgrades and equipment.


Monday 6 August 2012

New Game's a Load of Rubbish

Over the past few weeks I've slowly been starting on creating a new game, it's about a living trashbag and how it just wants to give other trashbags the gift of life! I've done some rough concept art and have also gotten about half of the menu working. Something that I'm doing differently with this game which I feel with help quite a bit is having most items have their own class. An example of is my general button class, I save myself a lot of lines by having the button set itself up after first creating it, then calling one function called startThis, it takes the x/y positions, the name of the button I want and the current movieclip that the button will be placed in. I have all the event listeners all set up by themselves for state changes and the only event I'm listening for is a custom event for when it's clicked. I hope to update this as I get more completed.