Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Wayne Adams on Sun 15/02/2009 07:31:29

Title: Maintaining player.y to a 1 pixel area [SOLVED]
Post by: Wayne Adams on Sun 15/02/2009 07:31:29
Howdy do, AGS forum people. I'm currently working on a point n click that keeps the player locked to the 201st pixel along the y axis, however, he only walks along it when the cursor is exactly on the walkable area 1 pixel line.. In games like Automation, and the Kuma demo, the player is bound to this row of pixels, and it works well.. is there some other method of moving the character, when this is the desired gameplay?

I'll be posting some screenshots before the holiday weekend is over, but for now I'd really like to wrangle this problem first.

Thanks in advance, gents and ladies
Title: Re: Maintaining player.y to a 1 pixel area
Post by: Trent R on Sun 15/02/2009 09:30:40
Can't remember where it says it in the manual, but walkable areas have to be at least 3 pixels wide to work.

Also, you might want to try to edit the on_mouse_click function in your global script. I'll come back in the morning and post a script, cause I'm dang tired and I'll probably mess up anyways.


~Trent
Title: Re: Maintaining player.y to a 1 pixel area
Post by: ThreeOhFour on Sun 15/02/2009 10:50:53
It sounds like you merely want to replace the normal left mouse button function with something like:


else if (button == eMouseLeft) {
    if (Mouse.Mode == eModeWalkto)  {
      ProcessClick(mouse.x, 201, mouse.Mode );
    }
    else ProcessClick(mouse.x, mouse.y, mouse.Mode);
  }


There's a bunch of ways of going about this, not sure if mine is the best for your situation.

This might mean a bit of extra code but:

Quotehowever, he only walks along it when the cursor is exactly on the walkable area 1 pixel line

You'd have to add a condition like:


else if (button == eMouseLeft) {
    if (Mouse.Mode == eModeWalkto && mouse.y == 201)  {
      ProcessClick(mouse.x, 201, mouse.Mode );
    }
    else ProcessClick(mouse.x, mouse.y, mouse.Mode);
  }


It seems a little strange to me to have a character moving along the Y axis, but if I've misunderstood your post, switch the mouse.x,201 with 201,mouse.y and you should be fine.

Hope this helps :).

Edit:

QuoteCan't remember where it says it in the manual, but walkable areas have to be at least 3 pixels wide to work.

Yep, but this does depend...

In Man Boy I used a walkable area of single pixel width and didn't seem to have any dramas - but that was with keyboad control :).
Title: Re: Maintaining player.y to a 1 pixel area
Post by: Trent R on Sun 15/02/2009 18:41:42
Quote
Also, you might want to try to edit the on_mouse_click function in your global script. I'll come back in the morning and post a script, cause I'm dang tired and I'll probably mess up anyways.
I was gonna post the first one that Ben wrote, which should work.

Quote from: Trent R on Sun 15/02/2009 09:30:40
Can't remember where it says it in the manual, but walkable areas have to be at least 3 pixels wide to work.
And I remember now. it needs to be at least 3 pixels for the pathfinder to work. But since you're walking from A to B in a straight line, you shouldn't need the pathfinder to kick in.

~Trent
Title: Re: Maintaining player.y to a 1 pixel area
Post by: Akatosh on Sun 15/02/2009 19:23:27
Why would you limit clicks to a ONE PIXEL high area? That'd be the mother of all annoyances.
Title: Re: Maintaining player.y to a 1 pixel area
Post by: Wayne Adams on Sun 15/02/2009 19:42:36
Thanks for the advice guys. Akatosh (Is that from Oblivion? I love that game) I don't want to restrict the player to having to click on one pixel, I'd fill the entire area up with walkable space, just so long as I knew the character's Y would remain locked to one row..

(http://www.wayneadams.net/stuffola/AGS_Stuff/example.jpg)

(http://www.wayneadams.net/stuffola/AGS_Stuff/example2.jpg)

Thanks again guys.
Title: Re: Maintaining player.y to a 1 pixel area [SOLVED]
Post by: Wayne Adams on Mon 16/02/2009 00:46:41
Thanks Ben, Trent... that mouse code did the trick
Title: Re: Maintaining player.y to a 1 pixel area [SOLVED]
Post by: ThreeOhFour on Mon 16/02/2009 08:08:36
Glad we could help :)