Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-09-2013, 09:08 PM
brokk brokk is offline
Registered User
Join Date: May 2012
Posts: 84
brokk is on a distinguished road
Looking for a solution

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.5player.y+1.5);
  
changeImgVis(201);
  
findImg(20).layer 0;
 }
//PLAYER IS IN AIR HERE, BUT TOOK OUT WHAT I HAD
 
if (player.canjump false){
 }
}



function 
onKeyPressed(codekey){
 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.5player.y+1.5);
    
changeImgVis(201);
    
findImg(20).layer 0;
    
//DELETED IDEA
    
}
   }
  } 
__________________
No matter how much I hate graal, I'm always coming back.

smh
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.