Not sure what to call the subject here ... umm HELP?

Started by DrewCCU, Tue 08/06/2010 22:19:15

Previous topic - Next topic

DrewCCU

The issue is:

When characters walk from point A to point B (say one character is walking to another character) AGS takes your move character code and tells the bottom coordinates of one image  to move to the bottom coordinates of the other image right?  (if the character was a human who had feet then the general area of the "bottom coordinates" would be where the characters feet are) Everyone still with me?

I hope so ... so anyway - what we have happening is character a walks to character b's position and stops when character a's feet touch character b's feet - maybe that cleared it up for anyone i lost.

well my issue is this ... i dont need ags to take the bottom right corner of the image and move it to a destination ... i want it to take the top center of the image and move it to the destination.  does that make sense? i sure hope so cus i need to figure this out .... help ... please .... pretty please.
"So much of what we do is ephemeral and quickly forgotten, even by ourselves, so it's gratifying to have something you have done linger in people's memories."
-John Williams

AdamM

For the record AGS moves the bottom centre of the sprite to the Walk co-ordinates.

This is difficult for me to solve without knowing exactly what effect you're trying to achieve. You could try giving the character a z property that is negative half of its sprite's height, in order to move the "feet" halfway up the sprite. Or, when you give the Walk command, add half the height of the sprite to the y co-ordinate. Then when it moves the centre of the sprite will end up where you clicked.

AdamM

So:

Code: ags
ViewFrame *frame = Game.GetViewFrame(cEgo.NormalView, 0, 0);

//And then:

cEgo.z=(0 - (Game.SpriteHeight[frame.Graphic] / 2));

//Or alternately:

cEgo.Walk(100, 100+(Game.SpriteHeight[frame.Graphic] / 2));


That, uh, that would work, right?

DrewCCU

Quote from: AdamM on Wed 09/06/2010 00:13:28
So:

Code: ags
ViewFrame *frame = Game.GetViewFrame(cEgo.NormalView, 0, 0);

//And then:

cEgo.z=(0 - (Game.SpriteHeight[frame.Graphic] / 2));



That, uh, that would work, right?

where would you put that? in Room Load?
"So much of what we do is ephemeral and quickly forgotten, even by ourselves, so it's gratifying to have something you have done linger in people's memories."
-John Williams

AdamM

Well, if you want your character to be centred in every room, game_start() is a better one.

Khris

Since you want the top center at the clicked coordinates, don't divide by 2.

AdamM


SMF spam blocked by CleanTalk