NAV16AP
1. jakso lukuvuonna 2016-2017
This time
start by making changes to the enemy object FSM so that it will recognize when
time has run out and will disable the enemy when try again screen is active. If
this step is not done then the player will be able to continue clicking the
enemy and getting points.
You’ll need
to create a new global variable for bool type. Then create two global events:
enable and disable. Link enable to the start state and use disable in a
completely new state. In the start state select action called bool test. Use
your bool in the bool variable section and select disable as is true event.
Remember to put a checkmark in every frame selection.
Also use bool
test action in the new state you have created. Choose your bool variable in the
bool variable section and enable as event in the is false section. Again put
checkmark in every frame selection.
In the yes
label you need box collider (this time use normal box collider instead of 2D),
Ngui events to playmaker fsm events-component and FSM. For this install
playmakerNGUI package: https://hutonggames.fogbugz.com/?W1111
In the yes
FSM you’ll need three states. In the first state use custom NGUI transition
event called on click. On press will also work here if you prefer to use that
one.
In the
second state create three actions:
1. Set in value
Select your score as the
in variable and set value of 0 for it
2. Set bool value
Select your bool
variable and leave other options blank. This will set the try again bool value
to false and player can start clicking again
3. Set property
drag your label to the FSM and set
property for the color. When player clicks the label it will change color for a
short time
In the last
state all you’re going to need is restart level action. This will reset the
level and player can try to get even bigger score this time.
FSM for no
label is almost the same as for the yes. You don’t need to set bool value in
the second state. Use only set int value and set property actions. Last state
will have action quit application or load level. It depends if you want the
player to be able to load main menu when he/she exits the clicker game or just
quits the application right away.
Then make
changes to the timer FSM. In the lose state add four actions.
1. You’ll need two activate game object
actions. One activates try again object and other one activates label that says
time is up. Try again object can be just a background in which the layer is set
higher than any other object in the scene. This try again background will cover
your other assets when time has run out.
2. Select send event by name action.
Choose your enemy as specified game object and send disable event to the hit
FSM. This will make your enemy unclickable when there’s no time left in the
timer.
3. Last action is set bool value in
which you’ll set the try again bool value by putting checkmark in the bool
value section.
After you have done everything for the try again then create new scene for the menu. In the menu scene you need three labels: title of the game, new game and exit game. Do these according to the instructions in menu post. Use your new menu scene as the loaded level in no FSM so that if player chooses not to try again then it will load the main menu. When all is done and working it's time to build the project.
Ei kommentteja:
Lähetä kommentti