Scrolling Credits Module

Started by Ghostlady, Wed 21/08/2024 01:19:52

Previous topic - Next topic

Ghostlady

Is there a current Scrolling Credits Module? I found a few listed in the forum but with old dates on them so I would like advice on which one to use.
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

RootBound

They/them. Here are some of my games:

Ghostlady

The link for the module goes to a funny looking download page.  Is this correct? Just want to make sure before I download.
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

heltenjon

Quote from: Ghostlady on Wed 21/08/2024 04:11:01The link for the module goes to a funny looking download page.  Is this correct? Just want to make sure before I download.
It directs to Khris's shared files. I think he's the safest one of us all.  :)

Khris

This is just a standard Google Drive download page.

You can also download directly from here: https://khris.ddns.net/modules/

Ghostlady

Thank you.  Ok, I downloaded the script, imported it and created a room and a gui gCredits. When I try to run the room I get this error.
Error (line 11): Undefined token "Credits" Here is my room script:
Code: ags
// room script file

bool credits_running;

function room_Load()
{
{
  int yellow = Game.GetColorFromRGB(255, 255, 0);
  int white = Game.GetColorFromRGB(255, 255, 255);
  
  Credits.SetFont(eFontFont0, 15); // font, line height
  Credits.SetColor(white); // default text color
  Credits.SetShadow(17, 1, 1); // color, offsetX, offsetY
  Credits.SetWidth(200); // total width of credits text
  Credits.SetDelay(1, -5); // 1 pixel per frame, 5 pixels per frame when mouse is held down

  Credits.AddLine("Made with", eAlignCenter, 0, yellow);
  Credits.AddLine("Adventure Game Studio");
  Credits.AddSpace();
  Credits.AddLine("Special Thanks To", eAlignCenter, 0, yellow); // yellow text
  Credits.AddLine("Alice", eAlignLeft);
  Credits.AddLine("Bob", eAlignRight, -1); // offset -1: add text to previous line
  Credits.AddLine("Charles", eAlignLeft);
  Credits.AddLine("Dick", eAlignRight, -1);
  Credits.AddLine("Eddie");
  Credits.AddSpace(50); // add gap of 50 pixels
  Credits.AddLine("THE END");
}

DynamicSprite* credits; // create pointer

void StartCredits() {
  credits_running = true; // set flag for room_RepExec
  gCredits.Visible = true; // show GUI
  credits = Credits.Tick(); // run first update to get sprite
  //gCredits.BackgroundGraphic = credits.Graphic; // set GUI background
}

void CreditsEnded() {
  gCredits.Visible = false; // hide GUI
  credits.Delete(); // clean up
  credits_running = false; // reset flag
  QuitGame(0); // or go to main menu
}

void DoCredits() {
  Credits.Tick(); // advance credits display
  if (Credits.Done()) CreditsEnded(); // credits have finished
}
}

function room_RepExec()

{
  if (credits_running) DoCredits();
}

void on_key_press(eKeyCode k) {
  if (k == eKeySpace) StartCredits();
}
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Khris

#6
Sorry, I just noticed I didn't upload the actual Credits module (laugh)
So whatever you imported wasn't the right module.

Please download Credits_0.1.scm from here https://khris.ddns.net/modules/

Also, your room_Load has two opening braces. That shouldn't compile anyway.
(Also make sure the two room* functions are linked in your room events, and note that my example code runs the credits when you press space.)

Ghostlady

Perfect, thank you I'll check this out.
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Ghostlady

The Credits Module is running great.  Thank you. Can you tell where I can slow it down some?
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Ghostlady

I figured out how to slow the scrolling.  I would like to have it start scrolling as soon as I enter the room as opposed to the space bar.  What would I need to change for this?
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Crimson Wizard

Quote from: Ghostlady on Sat 24/08/2024 02:38:37I would like to have it start scrolling as soon as I enter the room as opposed to the space bar.  What would I need to change for this?

Remove this:
Code: ags
void on_key_press(eKeyCode k) {
  if (k == eKeySpace) StartCredits();
}

And add this to the end of room_load:
Code: ags
function room_Load()
{
   ... other code still here ...

   StartCredits();
}

But if you do that you also need to move whole room_Load() function down the script, because the function that calls other functions must be located below them.

Ghostlady

My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

SMF spam blocked by CleanTalk