mmmm how set an object visible on other object!
Ahead or behind how to set? Please help
Which object is drawn on top is determined by the object's baseline.
By default, the value is 0 which means AGS uses the object's y coordinate/bottom edge.
You can override this by setting the baseline to something else:
oForeground.Baseline = 239; // draw foreground on top of everything else
An object with a lower baseline value appears behind objects with a higher baseline value because it is further up the screen and thus farther away.
Work fine! Thanks, but there is another problem!!
I've used Baseline on the second object, " object[2].Baseline = 239;" and now, it appear ahead the first object, OK. But when my character is near the second object, he appear behind in walk mode, how resolve!!
Characters also have a baseline property. If the character's y coordinate is less than 239, AGS will draw him behind the object.
So you could choose a baseline value for Object 2 which is greater than the baseline value of Object 1, but lower than the y position the player will have when he walks in front of it.
Or, you could leave Object 2's baseline at 0, and give Object 1 a baseline higher up the screen (say 10 or 20).
Hope that makes sense!
(By the way, I think questions like this should probably go in the Beginners Technical Questions forum.)
Like I said in the comment, setting an object's baseline to 239 will move it on top of everything with a baseline below 239.
If I understand you correctly, you want object[2] appear on top of object[1] but at the same depth in relation to other objects and characters.
Try this:
object[2].Baseline = object[1].Y + 1;
You can also set the baseline in the editor.
Thanks all!!
Very nice Khris!