Logo

SM5 - Font graphic won't obey draworder or z commands - SOLVED: Gameplay/SecondaryScore

Register Log In Back To Forums

Post #1 · Posted at 2014-09-11 03:22:28am 9.5 years ago

Offline Musashi
Musashi Avatar Member
108 Posts
United States
Reg. 2014-05-03


Last updated: 2014-09-12 02:54pm
I'm arranging graphics for Rave mode, and figured I'd put the LEVEL: X text in a frame. As I was arranging the X and Y coordinates, the level number appeared to vanish at times, then I moved it to the edge of the frame, where sure enough, I could see part of the number, but the rest was covered by the frame.

I started with a draworder,101 command, which worked for the Score in regular mode, but didn't get the level showing in Rave Mode. I then tried setting draworder astronomically high, followed by similar settings for z or addz, but the frame always overshadowed it.

Anyone know why?

Post #2 · Posted at 2014-09-11 03:33:32am 9.5 years ago

Offline Kyzentun
Kyzentun Avatar Member
3,209 Posts
United States
Reg. 2008-02-20

"I'm honestly pissed off."
Actors are drawn in the order they occur in. The last actor will the the one that is drawn last, and thus will appear on top of the others.
silenttype01: Kyzentun is never harsh. He says it how it is.

GENERATION 24: The first time you see this, copy it into your sig on any forum and add 1 to the generation. Social experiment.

Post #3 · Posted at 2014-09-11 02:53:04pm 9.5 years ago

Offline Mad Matt
Mad Matt Avatar Member
65 Posts
United States
Reg. 2011-10-26

I can't tell you exactly what you're doing wrong without seeing your entire setup, but here are some things to be aware of regarding draw order.

1) Within an ActorFrame ( without DrawByZPosition and DrawFunctions ), actors are drawn in the order they are sorted.

When an ActorFrame is loaded from a lua file, it will automatically sort by draw order after creating each of it's children. For any children that have the same DrawOrder as eachother, they will be sorted in the order they were created.

InitCommands of Actors are played as they are created, so if you change draw order in an InitCommand it will happen before this automatic sort. OnCommands are played after this automatic sort occurs. You can manually sort an ActorFrame by draw order at any time you like using the SortByDrawOrder method, but changing draw order without doing that will have no impact.

When using DrawByZPosition, the actors will be draw in order of their z position from lowest to highest.

2) DrawOrder is not global. It applies only within an ActorFrame.

When an ActorFrame is told to draw, it tells all of it's children to draw. If one ActorFrame draws before another, all of it's children will draw before all of the other ActorFrame's children.

Example: You have 2 ActorFrames called A and B, which are both children of the same ActorFrame. Neither A or B had their draw orders set in InitCommands, A was loaded before B, so A will draw before B.

A and B both have children, called C and D respectively. You give C a draworder of 100 and D a draworder of -100. C will be drawn before D because A draws before B.

Post #4 · Posted at 2014-09-11 05:45:12pm 9.5 years ago

Offline Musashi
Musashi Avatar Member
108 Posts
United States
Reg. 2014-05-03

Quote: Mad Matt
I can't tell you exactly what you're doing wrong without seeing your entire setup, but here are some things to be aware of regarding draw order.

1) Within an ActorFrame ( without DrawByZPosition and DrawFunctions ), actors are drawn in the order they are sorted.

When an ActorFrame is loaded from a lua file, it will automatically sort by draw order after creating each of it's children. For any children that have the same DrawOrder as eachother, they will be sorted in the order they were created.

InitCommands of Actors are played as they are created, so if you change draw order in an InitCommand it will happen before this automatic sort. OnCommands are played after this automatic sort occurs. You can manually sort an ActorFrame by draw order at any time you like using the SortByDrawOrder method, but changing draw order without doing that will have no impact.

When using DrawByZPosition, the actors will be draw in order of their z position from lowest to highest.

2) DrawOrder is not global. It applies only within an ActorFrame.

When an ActorFrame is told to draw, it tells all of it's children to draw. If one ActorFrame draws before another, all of it's children will draw before all of the other ActorFrame's children.

Example: You have 2 ActorFrames called A and B, which are both children of the same ActorFrame. Neither A or B had their draw orders set in InitCommands, A was loaded before B, so A will draw before B.

A and B both have children, called C and D respectively. You give C a draworder of 100 and D a draworder of -100. C will be drawn before D because A draws before B.

I think we have the reason here. I do believe separate Actor Frames are at work, but how to organize them..?

I believe the item in question is hardcoded. It (Rave Level, which is always 0,1,2,or 3)appeared when I first started testing conditional graphics for Rave Mode. I was able to apply a font to it by adding .png and .ini files to the Fonts folder with the name ScoreDisplayRave level. As such, no LUAs were involved.

I'll be working on it again tonight; I could see if there are metrics in [ScreenGameplay] that affect it, or see if I can use a LevelP1InitCommand within [ScoreDisplayRave].

Post #5 · Posted at 2014-09-11 06:16:20pm 9.5 years ago

Offline razorblade
razorblade Avatar Member
1,099 Posts
Not Set
Reg. 2011-03-01

Are you referring to those metrics below?

[ScoreDisplayRave]
LevelP1OnCommand=
LevelP2OnCommand=

FrameBaseP1OnCommand=
FrameBaseP2OnCommand=

FrameOverP1OnCommand=
FrameOverP2OnCommand=

Post #6 · Posted at 2014-09-11 07:20:17pm 9.5 years ago

Offline dbk2
dbk2 Avatar Member
332 Posts
Not Set
Reg. 2012-04-30


Last updated: 2014-09-11 07:20pm
Quote: Mad Matt
here are some things to be aware of regarding draw order.

That was highly informative, helpful, and interesting. Thank you.

Post #7 · Posted at 2014-09-11 07:35:30pm 9.5 years ago

Offline Musashi
Musashi Avatar Member
108 Posts
United States
Reg. 2014-05-03

Quote: razorblade
Are you referring to those metrics below?

[ScoreDisplayRave]
LevelP1OnCommand=
LevelP2OnCommand=

FrameBaseP1OnCommand=
FrameBaseP2OnCommand=

FrameOverP1OnCommand=
FrameOverP2OnCommand=

Yes; those (Particularly LevelP1OnCommand and LevelP2OnCommand) are where I initially tried adding a draworder command. Based on Matt's information, the ScoreDisplayRave and my graphic "ScoreFrame" are in different actor frames.

Post #8 · Posted at 2014-09-11 08:37:05pm 9.5 years ago

Offline Mad Matt
Mad Matt Avatar Member
65 Posts
United States
Reg. 2011-10-26

Quote: Musashi
Yes; those (Particularly LevelP1OnCommand and LevelP2OnCommand) are where I initially tried adding a draworder command. Based on Matt's information, the ScoreDisplayRave and my graphic "ScoreFrame" are in different actor frames.
I didn't know you were using the hardcoded ScoreDisplayRave.

ScoreDisplayRave is it's own type of object( which is derived ultimately from ActorFrame ). As I said in my previous post, setting DrawOrder in an OnCommand will not do anything, because an ActorFrame's normal sort by draw order( which occurs when loaded from a node (i.e. a lua file ) ) happens before OnCommands are played. In this case putting the sort in an InitCommand would not help either, because ScoreDisplayRave does not automatically sort by DrawOrder.

The simplest solution for you is probably to use the "FrameBase" child as your frame instead of the FrameOver, because it is already drawn below the text by default.

If you really want to change the draw order, you have numerous options, but using the metrics( ew ) you could do it something like this:


[ScoreDisplayRave]
LevelP1OnCommand=draworder,1;queuecommand,Set
LevelP2OnCommand=draworder,1;queuecommand,Set

LevelP1SetCommand=%function(self) self:GetParent()ConfusedortByDrawOrder() end
LevelP2SetCommand=%function(self) self:GetParent()ConfusedortByDrawOrder() end

FrameBaseP1OnCommand=
FrameBaseP2OnCommand=

FrameOverP1OnCommand=
FrameOverP2OnCommand=

Post #9 · Posted at 2014-09-12 01:32:46am 9.5 years ago

Offline Musashi
Musashi Avatar Member
108 Posts
United States
Reg. 2014-05-03

I have a solution: it was the second thing I suspected in light of learning about different ActorFrames and how they are drawn.

The metrics
SecondaryScoreP1OnCommand=

within [ScreenGamePlay] along with its brothers (ie P1-P2, On/Off Command, X-Y) control the Rave Level display. Since I'm now working within the ScreenGamePlay ActorFrame(s), draworders interact with other ScreenGamePlay objects. With this:

SecondaryScoreP1OnCommand=draworder,101
SecondaryScoreP2OnCommand=draworder,101

I got the level showing on top of the custom Score Frame.

Thanks Mad Matt, and good work by everyone!
Register Log In Back To Forums

0 User(s) Viewing This Thread (Past 15 Minutes)

©2006-2024 Zenius -I- vanisher.com -5th style- IIPrivacy Policy
Web Server: 4% · Database: 8% · Server Time: 2024-03-28 18:16:04
This page took 0.005 seconds to execute.
Theme: starlight · Language: englishuk
Reset Theme & Language