In my last blog I went over how to make the cPlayer invisible and how to add a spawn point for Luigi. In this blog I we will be adding a running, jumping, and falling animation. If you didn’t get the link earlier to download the “starter pack” I made the link is right here : https://drive.google.com/file/d/0B4T03AITeoiuWUF4MTROOU1mS2c/view
Once you get the file you can simply upload it to construct and you will not have to ad as many basic things but with that out of the way lets get started.
In this picture we only want to focus on the highlighted yellow code which is for Marios jump. It will set his animation to jumping and it will play the jumping sound once the now invisible cPlayer jumps. It will look something like this.
There is one problem with this however, and that is that once Luigi starts falling he will still be in the regular Luigi animation because we have not added a falling animation yet.
Now we will use the above highlighted code to make our player appear as if he is falling. With his falling animation and it should look something like this in game.
But the problem with this is once he hit the ground he thinks that he is still falling because we haven’t told him to stop falling. And the only reason he stopped jumping was because we added the falling animation.
Our next piece of code will tell him to stop falling once he hits the ground.
This code needs 2 verifications to allow him to run. He must be on the ground and he must be moving this will activate the running animation for your player and it should look like this.
So when our player is moving he will look like this although this does not fix our problem because he will still be falling when he hits the ground. For this code to work he also has to be moving. So we have to add standing code that overrides our falling code.
And with this our player will not continue falling when he hits the ground he will stop. Also just in case you dont know if you want to cause that big x infront of any code that means that code is inverted and to do that simply click on the code/highlight it and hit “i” on your keyboard.
Thats going to be it for this blog post I hope you enjoyed thanks for reading and check out my YT channel @Drago Gaming link: https://www.youtube.com/channel/UCrlNUqQVBxLIbdltHQBdcYg?view_as=subscriber