Walk behinds with walk areas, background picture scaling

Started by AntmanJB, Thu 11/01/2007 04:58:16

Previous topic - Next topic

AntmanJB

Hi everyone, I have two issues at the moment.

1. In my room, there is a staircase going up, but the character is also able to walk behind it. The stairs are separate in the picture, so you can still see the character between the steps when he's behind them. The thing is, when he goes to walk up the stairs, when he gets to the base line for walkbehind, he ends up behind the stairs because they over-lap, instead of staying on the staircase.
Is there any way I can fix this?

2. I thought it would be better if I drew my room pictures at a higher resolution (640*400) and then when I imported them they would look better at 320*200. But when I import them, they stay at their large resolution. Can the game be made to scale the pictures down, or do I have to do it myself in my paint program?

By the way I use Paint It, it's like Paint but with a few more tools. It comes with Creative Writer.
"Marge, it takes two to lie. One to lie, and one to listen."

Khris

1. Check if the player is on or behind the stairs by using a region or by checking player.x and player.y directly. Then use SetWalkBehindBase to dynamically adjust the baseline to the player's position.

2. You have to resize the picture before importing it. AGS won't do that automatically because importing images bigger than the room dimensions will make the room a scrolling room.

AntmanJB

Okay thanks for that. It sounds good, I'll go try it soon.
My computer was playing up before, I'm not sure why. Seems to be a RAM issue, it happened a while ago too.
Maybe it's because it's hot, I don't know.
Anyway, thanks again.
"Marge, it takes two to lie. One to lie, and one to listen."

AntmanJB

That did help, but there are still some problems.
Since the walkable areas of "under stairs" and "on stairs" overlap, when he goes under the stairs he can still walk out through the stairs. Is there any way to turn off one walkable area while he's under there?

Edit: I think I found a remove walkable area script in the manual.
I'll give that a try.
"Marge, it takes two to lie. One to lie, and one to listen."

Khris

Since one can't draw walkable areas on top of another, it's always a bit tricky having overlapping walkable things at different height levels.

Try the following:

(it's a bit sloppy, but you get the idea)

pseudo code room script:
int bl;  // baseline var, 0: normal, 1: on stairs, 2: behind them

// player walks on yellow region
disable brown wa
enable pink wa
bl=2;

// player walks off yellow region
bl=0;

// player walks on red region
disable pink wa
enable brown wa
bl=1;

// room rep_ex
if (bl==1) set stairs' walkbehind base to player.y-5;
else if (bl==2) set stairs' walkbehind base to player.y+5;
else set stairs' walkbehind base to 190 (reset to default);

I haven't tried this yet, and I'm not sure how the pathfinding will manage clicks far away from the current position of the player.
What could be done to improve the system:
In the global script's on_mouse_click, save the mouse coords to global variables, then call player.Walk(saved_x, saved_y); after enabling/disabling the walkable areas to reset the pathfinding.
(However, this might screw up everything :=)

I'm too lazy to put this into AGS right now, I might test it later.

Edit: I've tried it and it works perfectly.
Except one minor thing: if Roger stands on the yellow region and one clicks somewhere near the top of the screen, he won't go up the stairs but behind them.
One could add an additional check for this and use waypoints, I think.

Edit2: I've used this in on_mouse_click:
  if (button==eMouseLeft) {
    if (mouse.Mode==eModeWalkto && player.y>145 && mouse.y<120) {
      player.Walk(140, 200, eNoBlock, eWalkableAreas);
      player.AddWaypoint(mouse.x, mouse.y);
    }
    else
      ProcessClick(mouse.x, mouse.y, mouse.Mode);
  }
Works perfectly.

SMF spam blocked by CleanTalk