SetCharacterBaseline [SOLVED]

Started by Doctor Oakroot, Sun 05/12/2004 22:32:36

Previous topic - Next topic

Doctor Oakroot

I think this belongs in this forum because if this funtion did what I thought it did, I wouldn't be asking... so it must be a beginner's problem.

Here's the problem... the point that represents the base of my character is 15 pixels above the bottom of the sprite so that I have room for a foot extended forward of the base while walking.

So in the room script I added SetCharacterBaseline(EGO,15);

I've tried this at "Character Enters Room" (both before and after fadein).

It appears to have no effect. During run time, if I click at the point where the base should be, the character backs up until the bottom of the sprite is on that point (backs up because I've only drawn the walk down animation so far).

Am I calling this function incorrectly? In the wrong place in the script?

Ashen

I think SetCharacterBaseline() only affects how the character deals with things like objects and walkbehinds, not where it's walk-to point is. Also, I think it's in absolute, room-based units, not relative to the character - i.e. SetCharacterBaseline(EGO,15); will set the baseline to 15 pixels from the top of the screen, not 15 pixels up on the sprite.

Look up SetCharacterViewOffset. I think that's more what you want, just change the y-offset value accordingly.
I know what you're thinking ... Don't think that.

Doctor Oakroot

I guess I don't understand what one would use SetCharacterBaseline for.

I don't think SetCharacterViewOffset will do it... or more accurately, it would require moment-to-moment scripting control of all movement (might as well write the game directly in C).

I can't believe this is so uncommon a problem that there's not a simple solution to it.

Pumaman

#3
SetCharacterBaseline is for visual effects if you need the character to be in front or behind other things on the screen not in accordance with the normal z-order.

Your question raises an interesting point, though. I don't think anybody has brought it up before, but I'm not sure why. I guess it's because normally, due to perspective, the foot never actually goes any lower than the standing position and the walking animation would tend to use bent knees and a raised foot to simulate walking.

An easy enough workaround is to modify your on_mouse_click function so that if in Walk mode, the character actually walks to the mouse click location +15; though this won't work with walkable areas and so on.

Doctor Oakroot

For a future version, maybe you could allow setting a hotspot on a character (or on a sprite) just as you do on cursors.

I'm using photos of my step-daughter to create the sprites for my character so it may be hard to just redraw the step. But I'll give that a try.

BTW, is there a way to detect the current scaling of a character?

Ashen

#5
As I understand it, SetCharacterViewOffset() acts in the same way as setting a hotspot point for the character, so would that be of any more use? Presumably you'd still need the same "moment-to-moment scripting control of all movement", unless you mean setting a hotspot for each individual frame. Also, what resolution are you using? 15 pixels of blank space seems a lot for a step.

Anyway, I don't think there's a way to directly get the character's scaling, but you can use:
GetScalingAt (character[CHAR].x, character[CHAR].y)
Which returns the scaling at the point the character is standing, which is the same thing.
I know what you're thinking ... Don't think that.

Doctor Oakroot

Thanks. GetScalingAt should tell me what I need to know. I may try writing something to handle displacing the character's walk-to point.

I'm using 320x240 for this game. My character is 75 pixels tall (in 3D space) top justified in 90 pixel high sprites. Thus the 15 pixels. 5 pixels of that is just to put the walk-to point between the feet instead of at the toes.

I did get something workable by following Chris' suggestion and just shortening her lead leg, but I think I'll still try writing a script to move the walk-to point.

SMF spam blocked by CleanTalk