Hello. I need some help. I have a showImg shadow and I want it to follow player and it does. But the problem I am running into is when the player jumps, the shadow also follows the player's y value so there is no sense in depth when jumping. (Keep in mind player can move in all 4 directions just like default movement.)
So I come to you forums in need of help.
Some information on the jump action:
The player's y value goes -0.5 when jumps for a time of (0.5)
The player's y value goes +0.5 when falling for a time of (0.5)
So the jump is (1) total in time.
The Jump and Fall are just ran through a looping script.
Jumping works perfect, the shadow just doesn't like to.
I've tried:
1. Keeping the y value at one point once the player has left the ground.
Problem: When you move up or down while jumping, the shadow
jumps when you land.
2. A bunch of sleeps();
Problem: Glitchy
3. A butt load of scheduleEvents()
Problem: Even more glitchy.
PHP Code:
//#CLIENTSIDE
function onCreated(){
setTimer(0.05);
}
function onTimeOut(){
setTimer(0.05);
//SHADOW
if (player.canjump = true){
//THIS IS WHERE PLAYER IS ON GROUND. WORKS FINE
showImg(20, "shadow.png", player.x+0.5, player.y+1.5);
changeImgVis(20, 1);
findImg(20).layer = 0;
}
//PLAYER IS IN AIR HERE, BUT TOOK OUT WHAT I HAD
if (player.canjump = false){
}
}
function onKeyPressed(code, key){
if (key == "s"){ //'s' JUMPS. THE ACTION IS DONE ON ANOTHER SCRIPT
if (canjump = true){
//I DONT KNOW WHAT TO DO HERE. I TRIED A LOT AND FAIL EVERYTIME
showImg(20, "shadow.png", player.x+0.5, player.y+1.5);
changeImgVis(20, 1);
findImg(20).layer = 0;
//DELETED IDEA
}
}
}