AGS Support > Advanced Technical Forum
Easymirrors help?
tilapisha:
I'm having trouble implementing easy mirrors, specifically in declaring a new mirror - I'm confused what the parameter 'center' is.
--- Code: Adventure Game Studio ---struct Mirrors2{ //tells the module that character "c" can be used as a mirror reflection. //Call this function at least once (i.e. give the module at least one character) //otherwise it can't work! //You should call this function as many times as there are mirrors in the room // that has the most mirrors. //For example if there are two mirrors in a room, and if that is the room //of your game that has the most mirrors, then call this function twice. //(with two different characters!). import static void AddMirrorChar(Character* c); //Declares a new mirror in the current room. The player MUST be in that room when NewMirror is called! // This must be done only ONCE in the entire game (in "first time enters room") // The mirror starts disabled. It has to be enabled (using script) afterwards to be visible. // // 'mirror' is the object containing the sprite used as the mask. // 'center' is a marker. The center of its sprite (width/2, height/2) should be where the player would stand (his feet coordinates) if he was glued to the mirror ;) // 'symetry' is one of the symetries in the enum above // 'x_offset' and 'y_offset' allow to shit the reflection by a constant number of pixels // 'opacity' must be in 0.0, 1.0. Note: if the mirror's opcaity is 1.0 then it's fully opaque, therefore there's NO reflection! // 'distance_attenuation' (recommended value '60.0'): if the player stands 0 pixels away from the mirror, his reflection will appear fully opaque. If he's standing 'distance_attenuation' pixels away from the mirror (or more), his reflection will be fully transparent import static void NewMirror( Object* mask, //set to null if no mask Object* center, Region* reg, //set to null if mirror always on Mirrors_Symmetries symmetry, float opacity, float distance_attenuation, int x_offset=0, int y_offset=0); //Tells the module that this mirror should use an entirely //different character altogether as the reflection, instead of computing //the reflection. //That character should use Views that have the same number of loops and frames //as the player character. import static void SetSubstituteCharacter(Object* mask, Character* c); //To modify the offset you've set in NewMirror import static void SetOffset(Object* mask, int x_offset, int y_offset); //To modify the opacity you've set in NewMirror import static void SetOpacity(Object* mask, float opacity); //That doesn't delete the mirrors in memory (which is done automaticaly). It just disables them so that they're not rendered import static void DisableAllMirrors(); //Enables all mirrors in THIS room if they've been previously declared with 'NewMirror' import static void EnableAllMirrorsInRoom(); //Enables one mirror selectively import static void EnableMirror (Object* mirror);
I'm confused what I should put for the center parameter.
tilapisha:
This is the game: https://tilapisha.itch.io/gobyworld
Password: gummy
Github Repo: https://github.com/lishap/gobyworld
Khris:
My guess is that object is used to specify the coordinates used to position the mirror image. Draw a small cross hairs sprite (like 9x9 pixels or something like that) and put it on a new room object. Then move the object to the floor below the mirror.
tilapisha:
Hmmm, I did that, and still nothing.
Khris:
"Still nothing"?
As in, nothing mirrory happens in-game?
Did you activate the mirror?
--- Quote ---The mirror starts disabled. It has to be enabled (using script) afterwards to be visible.
--- End quote ---
Navigation
[0] Message Index
[#] Next page
Go to full version