SOLVED! Mirrors in AGS games

Started by Eon_Star, Thu 04/07/2024 18:41:34

Previous topic - Next topic

Eon_Star

I managed to create a mirror in my tutorial game.

I am sharing the link to the sample game. I will make a video to show you how I made.

The link to my tutorial is here: https://www.youtube.com/watch?v=UlH3ajz66LE

At first you can check the game file here (Mirrors.scm included):

https://eon-star.itch.io/bobs-quest-mirror-test


Import the Mirror script to your game and add the script below to your room script.

Create a character "CMirror1" and make its view the players normal view.

Create a "Region", an "Object" oMirror1 and a marker (oCenter1). Place the marker at the up edge of the region.
---------------
Important: There is an old script. If you get the error " LabelDebug.Text = String.Format("transp=%d", c.Transparency);"

delete this line from the script.

If you get a "Macro Error" change your characters name (If you change the mirrors name change that in the main script too)!

Test the mirror. Try to align the Center Point (oCenter1) object correctly and it will work.
------------

The Script for the room:

bool mirrorsCreated = false;

function room_Load()  // EntersRoomBeforeFadeIn
{

  //do this for each room that has mirrors
  if (!mirrorsCreated) {
   

 
    Mirrors2.NewMirror(oMirror1,  oCenter1, region[2], eSymmetryHoriz,  1.0,  50.0, 0, 10);
    Mirrors2.NewMirror(oMirror2,  oCenter2, region[3], eSymmetryHoriz, 1.0, 50.0, 0, 10);
    Mirrors2.NewMirror(oMirror3,  oCenter3, region[4], eSymmetryVertic, 1.0, 50.0, -10, 0);
   
    mirrorsCreated = true;
  }


  //You must enable the mirrors manually after you create them
  Mirrors2.EnableMirror(oMirror1);
  Mirrors2.EnableMirror(oMirror2);
  Mirrors2.EnableMirror(oMirror3);
  //you could also do : Mirrors2.EnableAllMirrorsInRoom();
 
 
}

Thanks to "Monsieur OUXX" from the community.

SMF spam blocked by CleanTalk