In our Main Game event enter code;
We set isAlive to one meaning player is alive, health is equalled to 10, and Player_DIR set to IDLE at the start of the game. Next line is set to an animation player to play when a player is IDLE. Now trick here is “ID_”&Player.Player_DIR, here our instance variable is IDLE, so it will play an IDLE animation. We don’t have to keep setting animation. Without writing lines of code when construct 2 is powerful enough to carry out your commands.
Setting camera to follow player every tick is the reason we have not used ScrollTo for the Player. I find this good way for scrolling. Please remember if you don’t know what lerp is then my advice is to read Famous Construct 2 Manual.
Lerp is a delay, intentionally added to the game by Valve for smoothing movements of players who use unstable internet connection. Every player is able to set the delay time (100ms or 0.1s by default). The default value is too much exaggerated from what the most players need.
Keyboard Plugin choose D, copy this 3 time;
Copy code above paste it 2 times, Left, and Jump, and change the codes;
All you have to do is make some changes for left, and Jump. In left Change Player_DIR to “LEFT”, and set animation mirrored. Change Player_DIR to Jump for W.
This is all very well but, if a player is not touching the Keyboard what has to be done? Well, we can use the statement like so;
If you check this above line it’s very easy to understand we just say set animation to IDLE. Simple;
As we want a player to Jump higher and higher whenever W is pressed repeatedly. We cannot do that without adding some kind of variable. For this reason, I want you to create a GROUP and name it Wall Jump. If you use a group like this inserting Local variable is easy, just click anywhere with mouse right button. First, add the Blank event in a group
Now right click mouse button anywhere and dialogue box open,
Just click on Local Variable and set Value; Wall_X = - 400 and Wall_Y = - 475