Maintaining player.y to a 1 pixel area [SOLVED]

Started by Wayne Adams, Sun 15/02/2009 07:31:29

Previous topic - Next topic

Wayne Adams

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

Trent R

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
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

ThreeOhFour

#2
It sounds like you merely want to replace the normal left mouse button function with something like:

Code: ags

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:

Code: ags

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 :).

Trent R

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
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Akatosh

Why would you limit clicks to a ONE PIXEL high area? That'd be the mother of all annoyances.

Wayne Adams

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..





Thanks again guys.

Wayne Adams

Thanks Ben, Trent... that mouse code did the trick

ThreeOhFour


SMF spam blocked by CleanTalk