Position at bottom of screen?

Started by Sheng Long, September 10, 2011, 12:57:51 AM

Previous topic - Next topic

Sheng Long

Okay, so I have a character show an explod effect at the bottom of the screen. It shows when the user's config is something like 640x480. However, when the user has 640x360 for wide screen mugen, the explod is shown off the screen (Can't bee seen). This is probably because I have my explod's pos at an exact position.

So I was wondering if there is any way to determine what the bottom of the screen is? Maybe there is a Top, or Bottom function for postype? I donno. But if there isn't, I could try a work around. For example, if users screen is 640x480, make the explod appear at the bottom starting at 240 (Mugen's resolution, not the game screen) where it's seen. But if the user is using 640x360, I would like the explod to be shown higher so that it appears on screen.

This is why I am asking if there's any way, or trigger function to detect bottom of the screen.

"You must defeat my flaming
dragon punch to stand a chance."

Cyanide

I haven't learned how to do the gamehieght shit. But for an explod. Postype = left, Y pos of 240 will be the bottom of the screen whether resolution is 320x240 or 640x480. Or at least, that's normally worked for me considering most stuff is given a localcoord of 320x240. Mugen does the conversion to place it right.

Breaks on the more window resolutions though... I think.


In M.U.G.E.N there is no magic button

They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance.

Алексей

Normally when I want to position things so they appear relative to other resolutions, I use const480p. So if you wanted to position it at 240, just wrap const480p around it. I've never tested this on odd resolutions like the one you mentioned, but that's the idea behind const480p.

pos = x, const480p(240)

-[Все слова это только слова.]-

Rajaa Retired

pos y - screenpos y + gameheight

That's the bottom of the screen.

Cybaster

Other solution is detecting your screen resolution a way or another :

[State Detect Screen Ratio]
type = VarSet
trigger1 = 1
var(XX) = (GameWidth/GameHeight>1.34)

Res=640*480 -> var(XX)=0
Res=640*360 -> var(XX)=1

And then use a pos = ifselse (var(XX)=1, AAA, BBB).
That's considering the player use regular resolutions though. So Rajaa's solution may be the best.

Sheng Long

#5
Hmm...... Raja's solution just identifies specifically the bottom, nevertheless whatever resolution the player is using.

Cybasters method seems to work though. Although I still have to use exact #'s for the Pos Y, where Pos Y = 180 for wide, and Pos Y = 240 for regular screen.

Maybe I could combine some of this to make it detect which resolution is being used instead of using exact #'s? I donno, just a thought.   :S

[State 820, Explod]
type = Explod
trigger1 = NumTarget > 0
ignorehitpause = 1
persistent = 0
pos = 0, ifelse((GameWidth/GameHeight>1.34),180,240)


So yea, that's what I did where I don't have to use a variable.

"You must defeat my flaming
dragon punch to stand a chance."

Rajaa Retired

You said you wanted to detect the bottom, that's the only thing I read so I just gave you the formula for that. What you want is a little different. The following formula is what you need:

ceil((1.33*gameheight/gamewidth)*A) *Use this for the Y axis of your explod.

That will get you as close as possible to your desired position and it'll be based off of the ratio of the character's game space coordinates, yours being 320, 240. If you do the math while excluding the multiplication of A, with your localcoords being 320, 240, then you will get you as close to 1.0 as possible, since 320, 240 is "normal." Any other other ratio will sort itself out, as far as I know.

Just change "A" to the screen position you want it to be. Be sure to use "postype = Left" for your explod.

The starting screen position of an explod with postype=Left is at 0,0 (the top left corner).

It's a formula that helped me position super portraits accordingly. I think it's what you're looking for, but I'm not 100% sure. If people are using weird resolutions like 480, 640, then those people are stupid and you shouldn't worry about them. =p

Sheng Long

Quote from: Rajajajajaja! on September 10, 2011, 08:15:01 AM
You said you wanted to detect the bottom, that's the only thing I read so I just gave you the formula for that. What you want is a little different. The following formula is what you need:

ceil((1.33*gameheight/gamewidth)*A) *Use this for the Y axis of your explod.

That will get you as close as possible to your desired position and it'll be based off of the ratio of the character's game space coordinates, yours being 320, 240. If you do the math while excluding the multiplication of A, with your localcoords being 320, 240, then you will get you as close to 1.0 as possible, since 320, 240 is "normal." Any other other ratio will sort itself out, as far as I know.

Just change "A" to the screen position you want it to be. Be sure to use "postype = Left" for your explod.

The starting screen position of an explod with postype=Left is at 0,0 (the top left corner).

It's a formula that helped me position super portraits accordingly. I think it's what you're looking for, but I'm not 100% sure. If people are using weird resolutions like 480, 640, then those people are stupid and you shouldn't worry about them. =p

So, for the A, if I change 'A' to something like 180 or 240, wouldn't it be only one or the other?


BTW, if this helps any, I am trying to do a 'Dan Forden' effect from Mortal Kombat, where he appears randomly at the bottom right corner after an uppercut. Except it's not Dan Forden I'm showing, but something else.

"You must defeat my flaming
dragon punch to stand a chance."

Rajaa Retired

What do you mean "only be one or the other"?

"A" should be based off of your own character's localcoord. Whatever position the explod would be for your localcoord is what "A" should be. You wouldn't need an "ifelse." Just try it out. :P

Sheng Long

Nice. Looks like it dos work. Interesting.  :)

Although, wouldn't something like ''ceil((1.33*gameheight/gamewidth)*LocalCord Y)" be a better option? I was thinking, if the local cord Y of the characters .def file was changed, then ceil((1.33*gameheight/gamewidth)*A) the 'A' would have to be changed here as well. But with ceil((1.33*gameheight/gamewidth)*LocalCord Y), one would only have to change one # as one wishes.

Of course, 'LocalCord Y' would be changed to whatever the actual control is.

"You must defeat my flaming
dragon punch to stand a chance."

Rajaa Retired

Since postype = left is based off of the screen position, you just need to select the specific point on the screen. The position you select won't be affected by the localcoord of your character since the equation itself is based off of the ratio of your character's game space. That's why it works in the first place. :P

If you wanted it to always be based off of your character's localcoord regardless of the resolution, then you would just find the percentage of your character's gameheight that is equal to the position you want. So for example, if you want the position to be based on half of your character's optimum resolution defined by the localcoord in the def file, then you'd do this:


ceil((1.33*gameheight/gamewidth)*(gameheight*0.5))

With that, no matter what the resolution, the explod will position as if the resolution was whatever your character's localcoord is defined for.

I hope that makes sense.

Sheng Long

Well, that just positioned it higher. X_X

Wow, thank goodness for Mugen 1.0. I'd imagine this would be a lot tougher to pull off without the local cords being there. Well, I guess it wouldn't matter anyway, since Winmugen didn't have wide screen features back then.  :S

Thanks for the info.

"You must defeat my flaming
dragon punch to stand a chance."

Rajaa Retired

Well, that made it higher because you just copy pasted without finding the the percentage of the screen position you want.

Just divide the position you want by the localcoord y and then multiply the value you get value by gameheight.

Glad I could be of help.