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
No comments:
Post a Comment