set character "baseline" possible?

Started by one2fwee, Sun 09/03/2008 02:08:00

Previous topic - Next topic

one2fwee

Is it possible to set a "baseline" for either a character or preferrably that character's individual views to stop things like this occuring?



Because the tail part is below the bottom of the main body of the character, the character appears to float when he gets to the top of the walkable area. Is there any way I can tell the game something to fix this?

Also, how does ags determine the bottom of a character - is it through the bottom of the image, including transparent sections? Or is it from the first row of visible pixels? I ask this, because my said character's "walk up" animation has his adomen moving up a bit in each frame, away from the bottom, in order to simulate a kind of "squashing his body together to move, wriggling" motion.

If there is no way to set this then i guess i'm just going to have to manually work out where to put the walkable areas up until?

Thanks for your time

Radiant

Yes.

In particular, the character[EGO] struct has a 'baseline' variable.

one2fwee

Hmm sorry I cannot see it?



Or is there someway to add it otherwise?
I just looked in help and there seems to be something about scripting it in, so I guess you would add that to the properties? Unlike backgrounds though, it seems there is no easy way to see the pixel values for a character? Will I just have to check in a pain program before hand or is there a way to get a "background style" pixel info in ags for characters?

Thanks, I didn't realise there were other functions not listed in the main box. I also assumed the help was exactly the same as in the normal tutorials :$

Hmm, I've done this, but it doesn't seem to do anything?



What am I doing wrong?

Also, can you have different baselines for different views / frames?

Thanks

OneDollar

Custom properties are a completely different thing, nothing to do with what you're trying to do. What you want to do is open up the global script, find the bit at the top that says #sectionstart game_start then in the game_start() function you want to add the line cEgo.Baseline=153; ie something like
Code: ags

#sectionstart game_start  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() // called when the game starts, before the first room is loaded
  {
    cEgo.Baseline=153;
  }
#sectionend game_start  // DO NOT EDIT OR REMOVE THIS LINE

(where cEgo is the character's script name, and without removing anything else already in there ;))

When the game starts this function is called before anything else, so you can use it to do some basic setup of the more advanced options that don't appear as regular properties in the editor. You can also change the baseline property at other points in the game if you want.

I think the baseline is set automatically from the bottom of the sprite, including transparent pixels, but I'm not completely sure on that.

one2fwee

#4
Ah okay thanks, I'll look into it later :)
Can I set a baseline for the individual up / down / left/right loops?  Or would I have to check when the character is changing loop / frame and then change the baseline.

Sorry, I am just very new to ags and I've never done any kind of game development before :$

Thanks for your help :)

Edit:
It doesn't appear to do anything? :o
Code: ags

#sectionstart game_start  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
  // called when the game starts, before the first room is loaded
  cEgo.Baseline=153;
}
#sectionend game_start  // DO NOT EDIT OR REMOVE THIS LINE


I set it to 0 and nothing appeared to change, and set it to 200 and nothing either. It's in globalscript.asc

Hmm very strange

Khris

What you want is to move the character's sprite relatively to its pivot vertically. This can be done using the character's z coordinate.
In game_start, set player.z (or cSnail.z) to something like -15. Then, the sprite will be displayed 15 pixels below its original position.
Alternatively, yes, don't draw walkable areas near the edge of the ground.

The baseline is only meant to determine whether or not something obscures characters/objects/part of the background.

one2fwee

Ah thanks, that works.

Slight problem though - it doesn't seem to be affected by scaling. If it is set for the normal sized character, then in a scaled area, the value doesn't seem to be scaled with the character itself. (This means if i set it for the scaled character then it means the normal sized character will still float etc. )

Radiant

That's right.

Possible workarounds include using the Z variable rather than baseline, or continually fixing the baseline in repeatedly_execure_always().

one2fwee

Hmm I was talking about the z variable though - it seems that it not scaled.

As is said above, the baseline does not appear to do what I need. It seems more about layering?

But yes I guess I would have to continually fix this. Sounds like it could get complicated but I will have to see... hmm

SMF spam blocked by CleanTalk