Monday, October 26, 2015

Week 5 Blog Post #4 Bugs , bugs and Confusion

For this week’s class we learned how to create how to create an animation and obstacles, which would need to be implemented in the game we are working on.

Here are my tasks to complete for this week: -
1. Create all game menus - Main Menu, Pause Menu, HUD, End (!) with animation and consistent fonts, colors etc.
2. Create the Game scene with player, jetpack, fuel, collectables, and obstacles.
3. Kill zone for out of scene objects.
4. Add a rocket.

Firstly before starting this week’s tasks I decided to clean up the existing project, as there were too many canvases but this rest most the button configurations I had made earlier while making the UI this will need some time to figure out as there are too many items under the canvas and thus I will continue this later.
Update: - made too many changes to the UI and need to ask tutor for help *

Items under canvas: -
Pause and resume button
Player name input and player name display
Start button
Score
Coins

Secondly I started off by creating an array to store my collectables fuel and obstacles and would spawn them based on the distance the player has travelled within the game. The array will contain a floating fuel tank, coins and one obstacle for now also it is all instantiated randomly between two given positions on the grid. One problem i encountered was that when nothing was stored in my array it gave errors which was resolved by adding a coin prefab into it.

Note: - never leave an array empty while it is public and can be accessed by unity.


Thirdly making a kill zone was easy, all I had to do was create a cube resize so the objects would collide and get destroyed .All I had to do was make a collision script that said if objects are triggers and are tagged with the tag of XYZ then to destroy the game object. To make it invisible I disabled its mesh renderer

Fourthly I have not found any appropriate assets for the game so I will leave my game as it is for now and only used colored materials for most the objects.

A few things fixed: -

While inputting the players name you could not see it this was solved by deleting the input field and recreating it.

While working on the coins instantiation I noticed that the coins were instantiating but did not move with the background after some tinkering I found out that I would need to make another script so that the coins move with the background.
                                                                                               
More bugs created: -

Cannot add fonts to the player name input as the text inside the input slot disappears.
Due to too many changes in the UI I have confused myself.

Monday, October 19, 2015

Week 4 Blog Post #3

For this week’s class we learned the new UI system unity, which is easy to use as it is more visual than the old system in which you would have to hardcode almost everything in script. We are supposed to apply the new UI system into our game and listed below are the specifics  


1. The game should have a main menu with a play button. It can have game artwork and any other elements you wish to add. The play button should start the game. One the play button is clicked. The menu should disappear.
2. The menu should also have a input field where the player enters his/her name. Once the player presses play/ hits enter on the keyboard, the menu should disappear and the name should appear on the status bar or the HUD within the game.3. Create an infinite scrolling background for the game.4. The HUD should also contain score/ distance travelled  


Firstly I started off with the infinite scrolling background which were two quads made to look like backgrounds and then we moved them along the X axis by going towards the –x coordinates and would reset its position to the starting position so it would look as the background is scrolling infinitely. While doing this I found a bug in unity that it does not autocomplete keywords used in unity, which confused me initially, but I reported it via the unity bug reporter and restarted unity which has temporarily stopped the problem .

Video of the infinite background: -
https://www.youtube.com/watch?v=LFycTOxVM0A

Secondly I added the UI elements such as score, distance and the players name .in order to take the players name I made a script called game manager where I would update the text based on the user's input but you would also need to add a name field where the player can type input and pass the input to the script in my case I had added the script to the Main camera and passed the camera onto the text input on the canvas.

Note- in order to use anything related to the new UI system you need to have Using unityengine.UI  learn more at (Unity , 2015)



 





















Thirdly, I got the score working same way as the name but I didn’t have to use the game manager as I am currently using the player's distance travelled as score for now later I shall multiply distance * coins collected. Though I had problems with the play button, when I hit the play button the panel is not disabling which was working before. Update :- had to make changes in the inspector in order to fix the problem .






 Lastly i faced some minor problems while making this project which i would address by I will ask my lecturer about this problem during the next class.


 References
Unity. (2015, July 24). Unity - Using the UI Tools. Retrieved from https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/using-the-ui-tools

Monday, October 12, 2015

Week 3 Blog Post #2 Assignment startoff


In this weeks class we started working towards our project which has some elements from jetpack joyride but the only thing I was afraid of was the fact that we had started a week later due to a national holiday and I would have one less week to complete it but my worries were gone when our tutor explained that we would be submitting in week 7 as we started a week later and I sighed breath of relief.

During we only made the player object and made it move around using Get Axis for the controls and adding force to jump into the air but before I got the movement to work I did a small minor mistake which was that I had put the code in update instead of fixed update which was my first mistake as I was applying force to a rigid body thus using physics for movement.

Note – when using force based movement use fixedupdate.

My goals for the current week is to make a main menu something simple that I can work on later while working on the main scene to complete the tasks provided by the tutor for this week which are listed below.

1. The jetpack can be used as long as the player has fuel. If he runs out of fuel, the jetpack switches off and the player falls.
2. Create fueling station with a fixed amount of fuel. If the player lands on it the player can refuel. Fueling happens based on time. The longer the player stays on a station, the more fuel he gets.
3. If the station runs out of fuel, indicate it using color or lights.

I was able to achieve the first part of my requirement easily using a If statement to say is the fuel was lower than a certain amount then the player should not be able to go up but I had some problems while making the fueling station as it was not adding fuel while the player was on the trigger and I will need to ask our tutor for help as I am facing a number of obstacles while making this project.

While incrementing the fuel variable I had some problems from my player script, as I had not set the variable to public static, which was causing problems while I tried to access the variable from the trigger script but later on I decided to use get component in order access the fuel variable form the player script.

Making the particle system was fairly easy and when I pressed the space key the particle system started but now for some strange reason I am unable to start it as I had initially made the system as a prefab and then deleted the prefab and recreated it as a child game object of the player my problem was overcome when I made the game object particle system into a prefab.

Another problem, for some reason the particles kept emitting even when the fuel was at zero , this problem was solved by putting a particle system stop under a if statement saying if fuel was 0 to stop the system .


Monday, October 5, 2015

Week 2 Blog post #1 - starting off


In our class started off with the best change we would ever get which is that we wont be using Moodle and would now be using Google classrooms which was good news for many other students too as it had a nasty habit of deleting our submissions.

During our class we were assigned homework, which is due in a few hours via Google classroom that is to create a small game like brick breaker in order to practice a few things we had done in class, which are listed below.

-Use get axis to move the paddle
-Instantiate rows of bricks to break in random colors
-Destroy the gameobject on collision with the ball.

 Though these are not the exact requirements they do include all we have done in class and should suffice as they are going to require the same code .The only difference would be the concept of brick breaker and the other game is marble shooter .





















(Walter/codeproject, 2004)



My goal for the week is to complete this game and turn it in.
Update, Homework was submitted

I was able to meet all requirements  and had no major difficulties doing this game apart from the randomization of the color of the bricks that were instantiated .I would address this issue by asking my tutor on how to randomize the color every time they are instantiated.



The paddle uses input.getaxis to move left and right and is limited to move between certain units using - playerPos = new Vector3(Mathf.Clamp (xPos,-10,10),-9.5f,0f);
Mathf.clamp Clamps a value between a minimum float and maximum float value. It was used to make sure the paddle that holds the ball did not collide with the walls as they had a physics material attached to them that allowed for the ball to bounce within the walls .












References
Walter/codeproject. (2004, January 11). Retrieved from http://www.codeproject.com/Articles/5832/Super-Brick-Breaker-A-Simple-DirectDraw-Game





UPDATE ****
APA formatting added as of  Tuesday,october 27th 2015