Footy Volley gameplay 8 – slide

 estimated time : 5 mn
ingredients needed : Unity, Playmaker
(this recipe is part of the footvolley game menu )

Detailed Steps

 Changing gameplay.
Create a new sliding animation.
Coding transitions to pass from animation state to another.

 

We’re now adding a new (and final) move : the slide.

Gameplay Perspective

In order to get a winning edge, the player must anticipate his position on the field.
The closest he is of the future position of the ball, the quicker will be his response. Allowing more time to position his aim, and a more powerful kick.

But if he’s real wrong on his positioning, there’s actually no way to catch up the ball due to his actual speed.

Let’s remedy to that, and spice up the gameplay too.

We’ll add the slide; a move that will allow a brief dash to catch up the ball if we’re too far.
But as even bonus in a gameplay should come with a malus, let’s review the bonus/malus of a slide :

BONUSES
  • Allow a boost of speed.
  • While sliding, you can collide with the ball without further need to release the shoot button.
  • While sliding, the collider will be wider; giving more chances to collide with the ball.
MALUSES
  • When the slide is started, you cannot change its course neither its duration.
  • After a slide, there will be a 0,5s time while the player cannot move.
    Usually, you’ll be able to slide once before the ball touches the ground, slide carefully.
  • If you reach the ball while sliding, the ball will be sent back at a random point on the opponent field at medium speed.
    It can be sent outside of the game field too.

With these additions, it should be funnier (well, at least I hope so).

Let’s work.

 

00:00 New animation

We first create a new animation for the slide, called “player_slide” with sprites from the asset.
Detailed steps for creating animation in our previous recipe : animating sprites.

You can retrieve the player animated sprite and other ones as an exclusive content on my patreon , otherwise you can use any sprite of course to use it.

01:44 Slide, animator view

 

Back to the animator view, we uncheck the loop parameter from the “player_slide” animation.
We add new parameter boolean value in the animator : “player_slide”.
This boolean will help us to jump from a walking animation to a slide animation, with the help of the transition conditions.

So we now create a transition from player_move to player slide.
Then we add the current condition : “if condition payer_slide is true”; meaning that if this boolean is true, so play the slide animation.
Then we go back to our Idle animation (because our player will be stuck for a second after a slide, so we don’t want to have the walking animation play as we’re not moving) by
making transition from “player_slide” to “player_Idle” with the condition :
If player_slide is false.

Now we’ll change our boolean values in order to trigger the animation changes.

 

02:40 Slide, playmaker view

To stop our slide animation, we will create in our Playmaker window a new action that will call a method to set back our boolean values to normal (means when not sliding).
We do this in our Player1 object on the release kick state; we add the send message event : stop_slide method.

Then we create the method in our PlayerController.cs and make some changes :

void addSlidingCoeff(){
//set the "player_slide" animator bool param to true
//in order to trigger the slide anim
anim.SetBool("player_slide", true);
//...
}
 
//then we create our stop sliding method:
void stop_slide(){
//set the "player_slide" bool to false in the animator
anim.SetBool("player_slide", false);
}

 

04:11 Testing and adjustments

 

Now testing, we see some glitches : we need to reduce the transition time of the animation here too, let’s do this in the inspector panel of the animator’s transition and we’re done.

 

What now ?

From the same basis, we can now add some animation when our player kicks, when the net is getting hit. It’s just up to you.
You can retrieve these animated sprites as exclusive content on my patreon , otherwise you can use any sprite of course to use it.

 

 

 

 

 

 

 

 

 

Leave a Reply