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 .


No comments:

Post a Comment