Hello there.
In this tutorial we’re going to create an avatar that can jump multiple times.
First you need to setup Visual Studio Code if it’s your first time.
Link to that here: How to start coding - YAHAHA Docs
After that create a basic project ( or a premade template it doesn’t matter )
Create an empty object and name it Game Logic so that you can find it easily.
Click on the Game Logic object that we’ve created and on the right we’re going to create a node graph for it.
Here I named the node graph Jump_Logic, but you can name it whatever you want it. But it’s better to name it something that you know what it is by reading in the case if you want to reuse it later on other objects.
Once you hit Done, then the Visual Studio code should open up automatically with the new Jump_Logic node component. It should be empty.
Now here’s the full node graph:
I’m not a 100% sure about the node, but here’s how I interpret it.
First there is the PlayerJoinedEvent, which fires when you join a game. After that we get the player entity with the GetPlayerEntity function ( this is not the avatar that you play with ).
After that we use the EventRegister function to register events for that player. ( sidenote here we used one, but we can have multiple events registered ).
We used the SpawnedEvent which is fired, when the avatar is spawned in the game ( so basically on every games start ).
Next we use the SetNumberOfJump function with a value of 10. In this case the player can jump 10 times. You can modify this value as you wish. It can be 2, 3, 4, 12345 It’s your choice.
After all this is done hit Ctrl + S to save the node ( in previous version of tutorials you had to compile it and save it, but as I’ve seen it you just have to save it and compilation is done in the background ).
For the avatar flip animation I didn’t do anything. It’s the basic animation as I see for multiple jump.
And basically that’s it. Congrats. Now you can multiple jump with your avatar.
Here’s the video as how it looks in action ( posted in Discord also ): Yahaha multiple jump - YouTube
You can get funky with it and add more logic/cases to it, like linking the number of jumps value to the item quantities in your backpack and stuff like that. ( if it’s highly requested then I can do a tutorial on it ).
Hope it was simple to understand and feel free to add extra information and feedback in the comments.