The Mugen Fighters Guild

Help => M.U.G.E.N Development Help => Code Library => Topic started by: Bane84 on September 06, 2005, 08:05:04 am

Title: How to position a character/helper wherever you want on the screen.
Post by: Bane84 on September 06, 2005, 08:05:04 am
While making the Shooter Game, I have come across the need where I need helpers to be at a certain position on the screen at a certain time (in regards to the ScreenPos trigger).

I found this formula pretty useful in getting them where I wanted them to go.

Use this formula with the PosAdd state control:

PosAdd(X) = Desired X Position - ScreenPos X
PosAdd(Y) = Desired Y Position - ScreenPos Y

Example:  Put a helper on the screen at position X=60,Y=100

[State #, PosSet]
type = PosAdd
trigger1 = (whatever)
X = 60-ScreenPos X
Y = 100-ScreenPos Y

You may or may not have a use for this kind of formula, but meh.
Title: Re: How to position a character/helper wherever you want on the screen.
Post by: 「ⒻⓊⒸⓀⓎⒺⒶⒽ」 on September 08, 2005, 11:10:00 pm
Haven't tried it yet, so, say I want to make a custom powerbar, would the same apply? Or a certain character face/icon. So it moves along with you regardless how many times the camera moves? I used an explod for that, or does this apply to a helper only?

EDIT: Because I think I've done something similar but it stuck at that position of the screen without using it. I was wondering if you can do any more indepth as to what this formula is used for? I'm just kinda confused now :sweatdrop:

The more I read it the more I don't understand (the description, not the code). :blank:
Title: Re: How to position a character/helper wherever you want on the screen.
Post by: aokmaniac13 on September 08, 2005, 11:14:46 pm
His method simplifies the placement of objects on the screen because you can use the screen's actual coordinates.  Using something like say... PosSet, X will be 0 at the center of the screen or centered on the character (depending on the arguments you set) and may cause problems, and the Y axis might be screwy as well.
Title: Re: How to position a character/helper wherever you want on the screen.
Post by: Bane84 on September 08, 2005, 11:17:40 pm
His method simplifies the placement of objects on the screen because you can use the screen's actual coordinates.  Using something like say... PosSet, X will be 0 at the center of the screen or centered on the character (depending on the arguments you set) and may cause problems, and the Y axis might be screwy as well.

Exactly.  This applies only to Characters/Helpers because they have Pos X/Y coordinates.  My formula sets these values relative to the on screen values.

For Explods, just stick with ScreenPos X and ScreenPos Y and set their offset to left.