Orros Game #3:Increasing and Decreasing Coin Counter
Like all previous activities, there are are still elements from them like the moving obstacle and moving object that is able to move in the whole screen. This time there is a score counter and objects that you collect will get you score. When you are hit by the obstacle then you'll lose a point each time the obstacle passes you.
The moving object or the Rat is still using the same script as the other two previous activities, and still using the same components like Rigidbody 2D and a Collider 2D. Its script that contains the speed is also changed depending on what speed of movement benefits the game most. The points or on what is in the example game, the chicken when you go past a chicken its script allows the chicken meter or point meter to go up each time. The player score and coin score are connected so that the data from when you go past a chicken shows up on text. The chickens also contain a circle collider 2D and you must have the "is trigger" checked. The cat which is the obstacle goes up and down which is previously shown on Game #2 where it contains a code that enables you to change the x axis and y axis and where it will go and also has a Rigidbody 2D with a mass of 1. There is also a part of the object that instead of +=1 it is -=1 in its trigger so that instead of an increase in score, the there is a decrease each time you get hit by the cat.
Player Score Script (Chicken)
Coin Score Script (Score Text)
Daga Movement Script (Mouse)
Cat Movement Script (Cat)



Comments
Post a Comment