Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Monsieur OUXX on Mon 02/12/2019 20:17:17

Title: Can't make character turn his back to camera while walking
Post by: Monsieur OUXX on Mon 02/12/2019 20:17:17
I'm trying to implement a "downhill" situation without the Downhill module.
What it means :
- The player walks DOWNWARDS (increasing Y coordinate)
- BUT In also want to show him walking with his BACK turned to the camera (as if his Y coordinate was decreasing).

The following code snippet fails to achieve that. The character keeps facing the camera the whole time What am I doing wrong?

Code (ags) Select

    player.StopMoving();
    StartCutscene(eSkipESCOrRightButton);   
    int characterWalkView = 91; int loopWalkNorth = 3; int loopWalkSouth = 0;
    player.LockView(characterWalkView , eKeepMoving); Wait(1);
    player.FaceDirection(eDirectionUp);
    player.Animate(loopWalkNorth, 2, eRepeat, eNoBlock, eForwards);

    player.Walk(player.x,  payer.y+50, eBlock, eAnywhere); //walk downhill
   
    player.UnlockView(eKeepMoving);
    EndCutscene();


Note: I've tried replacing .Walk with .Move but it doesn't work either : It seems like the movement speed is now very high (the player almost teleports). Also we can see his back but I'm not even sure it's animated (but that might be because it's super fast)
Title: Re: Can't make character turn his back to camera while walking
Post by: Crimson Wizard on Mon 02/12/2019 20:26:26
What about making separate walking view with swapped directions and doing ChangeView instead of LockView, and Walk normally?


PS. For the reference, this was from an old project I was working on (cancelled or suspended):
Code (ags) Select

function WalkDownTheDune(this Character*, int walkView, int duneHeight, int walkBehindArea)
{
  SetWalkBehindBase(walkBehindArea, 200);
 
  this.LockView(walkView);
  this.Animate(3, 0, eRepeat, eNoBlock, eForwards); 
  int w = this.WalkSpeedY;
  this.SetWalkSpeed(this.WalkSpeedX, 1);
  this.Move(this.x, this.y + duneHeight, eBlock, eAnywhere);
  this.SetWalkSpeed(this.WalkSpeedX, w);
  this.UnlockView();
}

function WalkUpTheDune(this Character*, int walkView, int duneHeight, int walkBehindArea, int topX, int topY)
{
  SetWalkBehindBase(walkBehindArea, 200);
 
  this.x = topX;
  this.y = topY + duneHeight;
 
  this.LockView(walkView);
  this.Animate(0, 0, eRepeat, eNoBlock, eForwards); 
  int w = this.WalkSpeedY;
  this.SetWalkSpeed(this.WalkSpeedX, 1);
  this.Move(this.x, this.y - duneHeight, eBlock, eAnywhere);
  this.SetWalkSpeed(this.WalkSpeedX, w);
  this.UnlockView();
 
  SetWalkBehindBase(walkBehindArea, 0);
}


So there I used Move actually, but changed Y speed. Too bad I don't remember why.
Title: Re: Can't make character turn his back to camera while walking
Post by: Cassiebsg on Mon 02/12/2019 21:03:53
If he's meant to always have his back to the camera, shy not just change the walk view, where all loops are back views? Then you would just have to deal with the inverted y. Or am I missing some key detail?
Title: Re: Can't make character turn his back to camera while walking
Post by: Monsieur OUXX on Tue 03/12/2019 12:40:54
Changing the entire view (even if only temporarily) is a good-enough workaround. I'll try it.
Thanks