Question: Changing the centre-point of character views

Started by , Thu 25/01/2007 23:49:04

Previous topic - Next topic

nootrac

Hi everyone, I'm a bit new to AGS and am just fiddling around trying to see what it's capable of.  I've checked the manual and forums, but can't seem to work this one thing out... (I really hope this isn't a stupid question...)

Basically, is there any way to change the 'centre' point for a view used as a character animation?  It defaults to the bottom centre of the sprite, so that when you click the walk cursor, the sprite moves so that its bottom centre is at the place you clicked (hope that makes sense!)

For example, if I wanted to do something like that scene in Sam&Max, where the room is upside down and you're standing on the ceiling, I'd have to change the centre point to the top middle of the sprite, otherwise it'd look all wrong.  Or, if my character had a shadow that extended a few pixels down from his feet.  I'd want his feet to line up with the place I clicked, not the bottom of his shadow.

twin-moon

To my knowledge you can't change the place where the sprite is drawn.
However, if you wanted to do something like let someone walk on the ceiling, you'll have to play around with the walking areas.

If your character is 15 pixels high (and upside down) draw your walking area also 15 pixels lower. This way, his feet are always on the right spot.


Good luck from another newbie.
                                    The Grey Zone

strazer

Or you can set the Character.z property to vertically offset the sprite from its real coordinates.
Try putting this in the upside-down room's repeatedly_execute interaction:

Code: ags

  // room repeatedly_execute
  player.z = -(Game.SpriteHeight[player.Frame.Graphic]);


Edit:

You may run into scaling issues later on, try searching the forum for "walking on ceiling" and similar, you will find previous threads about this subject.

Khris

Quote from: Dutch Mountaineer on Fri 26/01/2007 00:30:54If your character is 15 pixels high (and upside down) draw your walking area also 15 pixels lower. This way, his feet are always on the right spot.
In relation to the room, yes, in relation to the clicked coords, no.

I'd intercept a walkto-click:
Code: ags
function on_mouse_click(MouseButton button) {
  ...
  if (button==eMouseLeft) {
    int y=mouse.y;
    if (mouse.Mode==eModeWalkTo) y+=5;  // char will walk to spot 5 pixels below clicked one
    ProcessClick(mouse.x, y, mouse.Mode);
  }
  ...
}

SMF spam blocked by CleanTalk