SOLVED: Player leaping over objects... leaps right but not left properly..

Started by steptoe, Tue 08/05/2012 12:22:13

Previous topic - Next topic

steptoe

Hi

I seem to have run into a slight snag and can't quite see what the problem is.

I have a character that can jump up and grab objects in the air and then drop back down. This is perfect and is set off by a Button: Jump.

I also have a Leap Button that causes the player to Leap over objects.

However, it seems to always leap in one direction: right.

The Jump events do NOT seem to affect the Leap events.

Player Views are ok.

EDIT: This Script seems to work:
Code: ags

function Button2_OnClick(GUIControl *control, MouseButton button)
{
  
  //PLAYER LEAPS
  
   if (cspud.Loop==2 )
   {
  
   cspud.LockView(12);
   cspud.Move(cspud.x+80, cspud.y-60, eBlock, eAnywhere);
   cspud.Move(cspudx-0, cspud.y +60, eBlock, eAnywhere);
   cspud.UnlockView();
   cspud.FaceLocation(640, 374);
   } 
   
   else if (cspud.Loop==1)
   {
   cspud.LockView(12);
   cspud.Move(cspud.x-80, cspud.y-60, eBlock, eAnywhere);
   cspud.Move(cspud.x-0, cspud.y +60, eBlock, eAnywhere);
   cspud.UnlockView();
   cspud.FaceLocation(0, 374);
   
   } 
   
   else if (cspud.Loop==0)
   {
   cspud.LockView(12);
   cspud.Move(cspud.x-0, cspud.y-60, eBlock, eAnywhere);
   cspud.Move(ccspud.x-0, cspud.y +60, eBlock, eAnywhere);
   cspud.UnlockView();
   
   }
   }
   


OLD CODE:

Code: ags

function Button2_OnClick(GUIControl *control, MouseButton button)
{
  
  //PLAYER LEAPS
  
   if (cspud.FaceLocation(640, 370))
   {

    cspud.LockView(12);
    cspud.Move(cspud.x+80, cspud.y-60, eBlock, eAnywhere);
    cspud.Move(cspud.x-0,  cspud.y +60, eBlock, eAnywhere);
    cspud.UnlockView();
  
   } 
   
   else if (cspud.FaceLocation(0, 370))
   {
   
   cspud.LockView(12);
   cspud.Move(cspud.x-80, cspud.y-60, eBlock, eAnywhere);
   cspud.Move(cspud.x-0,  cspud.y +60, eBlock, eAnywhere);
   cspud.UnlockView();
   
   }
   } 


Can if you can spot where the problem/error may be or something I have overlooked?

Cheers
It's not over until the fat lady sings..

Gilbert

Simple. "if (Character.FaceLocation())..." will NOT work.

FaceLocation() is to make the character face the specified location, not checking which direction he is facing. Just check the loop like your own fix instead.

steptoe

It's not over until the fat lady sings..

SMF spam blocked by CleanTalk