How to Make a Mirror

Started by SSH, Thu 03/07/2003 15:17:44

Previous topic - Next topic

SSH

-------------------------------------------
2 different ways of making a mirror, as suggested by MrColossal and timosity
----------------------------------------

MrColossal
--------------------------------------------------------------------------------
try making a new walkable area behind the mirror and adding a walkbehind area over everything in that area but the mirror so the mirror acts as a hole, ya know?

then make a new character that is exactly like the one you want to reflect so you'll have EGO and then like EGOMIRROR

place EGOMIRROR on the walkable area behind the mirror then move him to the players coordinates except subtract 50 from the x value so he is always 50 pixels above the main character

50 is just a random number i picked out of my butt, experimenting will help

so you could either add to the on_click event or the rooms repeatedly execute something like

MoveCharacter(EGOMIRROR, character[EGO].x-50,character[EGO].y,0);

if i'm not totally retarded this should work

the reason i'd add it to the on click even is cause then you don't have to run a check to see if EGO is moving or not

so i'd have:

function on_mouse_click(int button) {

if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
}
else { // right-click, so cycle cursor
SetNextCursorMode();
}

if ((button==LEFT) && (player[EGO].room==theroomwiththemirro)){
MoveCharacter(EGOMIRROR, character[EGO].x-50,character[EGO].y,0);
}
}


i hope i know what i'm talking about...

eric
---------------------------------------------------------------------------
---------------------------------------------------------------------------

Timosity
--------------------------------------------------------------------------------
I have another code for a mirror that SSH helped me with, which is different to Eric's as it allows you to move closer and further from the mirror and not always stay the same distance away.

Have the two characters in the room (The main character, and their reflection) with all the walkbehinds as Eric mentioned.

note: in this example LAZ is the character and LMI is the reflection.

------------------------------------------------------------------------------------

//at the top of room script

int mirrorbase=132; //this is the y value which will be inbetween the 2 characters.
int laz_dist_from_mirror;
int lmi_dist_from_mirror;
int scale=3; // you can experiment with this number depending on the size of room and character.


// script for room: Repeatedly execute
character[LMI].x=character[GetPlayerCharacter()].x;

laz_dist_from_mirror=character[GetPlayerCharacter()].y-mirrorbase;
lmi_dist_from_mirror=laz_dist_from_mirror/scale;
character[LMI].y=mirrorbase-lmi_dist_from_mirror;


character[LMI].loop=character[GetPlayerCharacter()].loop;
character[LMI].frame=character[GetPlayerCharacter()].frame;

------------------------------------------------------------------------------

Then with the character in the mirror, set their view so that left and right are the same, but walking up should be down, and down should be up.

and if you want to get more technical, you can have it so in the mirror characters view, they walk with the opposite leg first in each direction to get the complete mirrored effect.

This works as a complete fully functioning mirror.

As for what Quintaros said, it could work: put an object on the screen where the mirror is (lets say it's object 1)

then in the room (before fadein)

SetObjectTransparency(1,90); // object 1 at 90% transparent (experiment with the number with 100 being totally transparent)

Note: I think tranparency only works in high colour games

Hope this helps.

~Tim Ã, 
12

SMF spam blocked by CleanTalk