Due to not knowing how to fix the problem I have been having with replayability, and liking the game at its current state, I have decided to call it done, and class it as a finished 'version 1' of the game.
If I were to have known more about flash then i'm sure that I could have gotten this far without the use of online help and tutorials (as referenced along the progress), and could have possibly overcome the problems which I am left with, mainly the replayability which has become a problem which I couldn't fix.
However, I am pleased with the final product and will want to improve upon it in the future when I learn more about using flash for games. I have overcome many problems and learnt a great deal from creating this flash game, it has been both stressful and enjoyable. Unfortunately I was obviously restricted due to it being my first flash game, but I used a handful of tutorials as referenced, to help me learn some extra bits of code to do what I did not know how to. These I then understood what they did before using them as part of my code. If I were to do it again I would hope that by then I will have had more experience in this area and will be able to improve upon it, although I am very happy with how this game has turned out!
Here's a short list of assets that were created and used throughout the creation of the game. Apart from those below, I also created text which is displayed on the game over/win frames, and the beginning, but also an explosion used for the lose frame.
So here it is, I introduce to you, the Battleship Invasion!
IDAT 102
Sunday, 30 January 2011
Problem
I now have only one problem, and that's replayability. If I enable the beginCode function to play automatically upon starting the game, then it is possible to play the game again after losing/winning. If the beginCode function does not start automatically, then I have a fully functional game except you can't replay it without refreshing the web page.
Why does it have to be so confusing! aha
Why does it have to be so confusing! aha
Saturday, 29 January 2011
Design for game over frame
I decided to create something related to the theme of battleships and attacking an enemy base, so I have created a big explosion and changed the background colour to be monochromatic, so that the focus is on the fatc that the base has been blown up thanks to the player! Here's what it looks like;
As you can see, the "you scored:" part does not show any values. This is due to a reason I am unaware of ,so it will more than likely be removed so that I can remove as many faults that are still remaining. I am still having trouble getting it to replay the game properly. Removing the function to create extra levels made it possible to now return to the beginning frame, however it does not re-call the functions like it should, but instead switches between frame 1 (start) and frame 25 (end) by mouse click.
Adding some outside influence
I remembered the lecture from last week where we were shown how to get the computers' time and/or date, which would be very useful to include within my game, to change something depending on the time. I decided then to use this idea to change the background to a day/night themed image depending on the time that the computer playign the game is set to.
My initial code was formatted with variables to collect the current time, and then a function with an if function for each hour, to then set the background to day or night (again variables for both backgrounds) which it would change to through the addchild function, to place an image onto the stage through code. This however didn't work, and I doubt it would have worked as I wanted it to. Luckily another iDat student offered some help with a piece of code which would work how I wanted to, so thankfully I was able to use it within my code and it worked great. A big thanks to Joe WljgrsMott!
Here's a quick comparison screenshot to show the time and that it has changed the background image;
My initial code was formatted with variables to collect the current time, and then a function with an if function for each hour, to then set the background to day or night (again variables for both backgrounds) which it would change to through the addchild function, to place an image onto the stage through code. This however didn't work, and I doubt it would have worked as I wanted it to. Luckily another iDat student offered some help with a piece of code which would work how I wanted to, so thankfully I was able to use it within my code and it worked great. A big thanks to Joe WljgrsMott!
Here's a quick comparison screenshot to show the time and that it has changed the background image;
Friday, 28 January 2011
Almost there..
I decided to go through the tutorial that I had linked in the previous post, so that I could gain an understanding of several bits of code which I would have obviously been unfamiliar with due to not making a flash game before. I guess the fortunate thing is that the codes I did use from the tutorial did not make it fully functional. This meant that I then had to look through the code more carefully, and to try and fix the problems myself, or to research for solutions elsewhere.
The problems included;
These functions are placed within the stage as event listeners, so that they will be running throughout the game.
3. This was fixed at the same time as ammending problem number two. I had an if function within the check level function, to check whether the lives count was at 0, which would then stop the game and move to the game over frame.
4. The hitboxes weren't working due to having named some part of the code wrong, so I played around with naming the parts different, and also checking whether it was the name of the box object itself, but eventually I managed to fix it. I think it was a conflict with the name being used for several different parts of the code, that it then created an error.
5. The ball was becoming stuck underneath the ship/bar, but this was due to there being a gap underneath. This was simple to resolve, I just needed to lower the ship so that it was touching the floor of the stage. The problem was still with the shape of the ship, but I didn't want to create a square block as I wanted my game to be somewhat unique in comparison to generic brick breaker style games, so I kept the shape of the ship despite how it would create a problem with the angle that the ball would bounce off from it.
Using the tutorial did however teach me several things, including;
The problems included;
- Creating extra levels didn't work as I had intended (I'm considering to remove the extra levels idea so that it is functional)
- Lives and score do not automatically update, nor do they work as I wanted them to
- The problem above means that my game over page also does not work as intended
- Crate hitboxes not working
- Ball gets stuck
- The levels I will remove, as I do not know how to create them properly, nor how to fix the code from the tutorial for it. This will hopefully mean that I will have less errors with my game and can progress further
- The lives and score counters were fixed by including two dynamic text boxes on the stage to display the running totals, so that I could then see that the code was working correctly. I included two functions to update/check the score and lives totals, and to go to the game over frame when the lives count is equal to 0.
function updateScore():void{
points += 10;
txtScore.text = "Score: " + points.toString();
}
function updateLives():void{
lives --;
txtLives.text = "Lives: " + lives.toString();
}
points += 10;
txtScore.text = "Score: " + points.toString();
}
function updateLives():void{
lives --;
txtLives.text = "Lives: " + lives.toString();
}
These functions are placed within the stage as event listeners, so that they will be running throughout the game.
3. This was fixed at the same time as ammending problem number two. I had an if function within the check level function, to check whether the lives count was at 0, which would then stop the game and move to the game over frame.
4. The hitboxes weren't working due to having named some part of the code wrong, so I played around with naming the parts different, and also checking whether it was the name of the box object itself, but eventually I managed to fix it. I think it was a conflict with the name being used for several different parts of the code, that it then created an error.
5. The ball was becoming stuck underneath the ship/bar, but this was due to there being a gap underneath. This was simple to resolve, I just needed to lower the ship so that it was touching the floor of the stage. The problem was still with the shape of the ship, but I didn't want to create a square block as I wanted my game to be somewhat unique in comparison to generic brick breaker style games, so I kept the shape of the ship despite how it would create a problem with the angle that the ball would bounce off from it.
Using the tutorial did however teach me several things, including;
- Adding labels to frames, so that you can call a frame by a label rather than a number
- A detailed reminder about using trace as a digital feedback whilst improving the coding, as it will create a response in the output box inside flash when that function is used.
- Adjusting an objects' speed, and to make it bounce off when it collides with another/wall
- Variables can be used to store numeric/text data
- You can create a function with all of the data you want loaded at the startup, and then use a simple line of code such as 'beginCode();' to call it.
- Using additional Actionscript files allows certain code to be used in other flash games too, rather than having to include the same length of code in another game, it can be used as an external file to load, similar to javascript or CSS files with web design
Wednesday, 26 January 2011
Useful tutorial
Due to my ball not hitting the sides properly when it randomly moves around the stage, I decided to find a tutorial to help me; Brick Breaker Tutorial
This will also help me further down the line when I come across any other problems or go out of my depth, so that I can understand how things work and include them into my game.
This will also help me further down the line when I come across any other problems or go out of my depth, so that I can understand how things work and include them into my game.
Progress!
As I wasn't sure how to make the ship move left and right, I found a quick tutorial for how to do so.
Movement with keys
Using this tutorial taught me that before you can use a variable, you need to create it, then set it to false so that it isn't used without a key being assigned for it to be used. You then have to create two statements for when it is pressed and is not, so that you know what the event will be if you do either.
So where am I currently? Well here's my rough list of what needs to be done;
I've got a while to go!
Movement with keys
Using this tutorial taught me that before you can use a variable, you need to create it, then set it to false so that it isn't used without a key being assigned for it to be used. You then have to create two statements for when it is pressed and is not, so that you know what the event will be if you do either.
So where am I currently? Well here's my rough list of what needs to be done;
- Bar movement
- Bar stays on stage
- Ball movement
- Ball stays on stage
- Boxes
- Boxes dissapear on hit, add score
I've got a while to go!
Subscribe to:
Posts (Atom)

