View Single Post
  #13  
Old 07-10-2013, 04:36 PM
brokk brokk is offline
Registered User
Join Date: May 2012
Posts: 84
brokk is on a distinguished road
Quote:
Originally Posted by callimuc View Post
This is something that could work. Not 100% sure but I can't see something wrong


PHP Code:
//#CLIENTSIDE

const JUMP_HEIGHT 1//Player can jump one tile high

function onKeyPressed(codekey) {
    
//Won't change the player.canJump as you could keep it as a check
    //If the player could jump in theory for other scripts
  
if (key == "s" && player.canJump == true && player.== 0) {

      
//Create the shadow image
    
showImg(20"shadow.png"player.x+0.5player.y+1.5);
    
changeImgVis(201);
    
findImg(20).layer 0;
      
      
//I rathered to make it into one for() loop and have if statements
      //Inside of it instead of creating 2 loops, probably just a personal
      //Preference
    
for (temp.0temp.JUMP_HEIGHT*2temp.+= 0.05) {

        
//Since i took the JUMP_HEIGHT times 2, I can create such a check
      
if (temp.JUMP_HEIGHT) {
        
player.+= 0.05//Move the player up
      
}
      else {
        
player.-= 0.05//Move the player down
      
}
    }

      
//failsafe reset the player.z
    
player.0;

      
//hide the shadow as you will probably move back to the original one
    
hideImg(20);
  }

I had just read read this this morning but I figured it out last night! thanks though!

I just simply change the z value of the player and the shadow stays at (player.x), and (player.y-player.z)

Works like a charm. I never knew about the z factor til yesterday so I would like to thank you graal forums for making life a lot easier on me lol
__________________
No matter how much I hate graal, I'm always coming back.

smh
Reply With Quote