Nothing inside this room's function will work... (SOLVED)

Started by Vera, Mon 13/07/2009 06:42:10

Previous topic - Next topic

Vera

I feel like I'm doing something very stupid, like making a spelling error, but I've gone over this and I can't figure out why it's not working. Perhaps a fresh pair of eyes will help?

The player is taken to room 2 from room 1. The player's character isn't shown because this is a start up menu type of thing. After fade in, an object should appear and animate continuously in the background while a GUI (with no background image or border, just buttons!) shows some buttons you can click on to do some stuff.

Here's my code:

Code: ags
// room script file


function room_AfterFadeIn() {
  oNewLoadBG.Visible = true;
  oNewLoadBG.SetView(5, 0, 0);
  oNewLoadBG.Animate(0, 5, eRepeat, eNoBlock);
  gStartUp.Visible = true;
  gStartUp.BackgroundGraphic = 0;
  }


FYI - oNewLoadBG is the name of my object I want to show and animate. It is actually the same size as my background. I want it to ACT AS my background since I can have more animating frames with an object than I can with the actual background.

I want this object to animate while the GUI is up. The only thing visible on the GUI should be the buttons, so the whole thing should appear as a pretty animating background scene with some buttons laying on top.

THE PROBLEM

Nothing inside the function works. It won't even make the object visible, let alone animate. Am I missing something in my code? Is there something elsewhere in my game that could be blocking everything in this function? Any suggestions on what to be aware of that might interfere with it would be very helpful.

monkey0506

The only thing I can think of that would prevent that from being run is the function not being properly linked in the events pane. In the same place as where you set all the room/hotspot/object/GUI/Character/etc. properties, right above that you should see a lightning bolt icon (when you have the room file opened). Make sure that the "Player enters room (after fade-in)" function is properly linked (it shows this function name, "room_AfterFadeIn") in the appropriate box there.

Vera

Ah yes that worked! I always forget one little thing or another. Thank you very much!  :)

TerranRich

Yes, you never add the functions yourself. Let the editor do that, and then it'll bring you right to the new function.
Status: Trying to come up with some ideas...

monkey0506

It is okay to add the functions yourself as long as they're properly linked. :P

The easiest way to do it is just to use the ellipses button (...) beside each event which will create the function for you (as Terran said).

TerranRich

Yes, but it's easy to forget to properly link them, AND you have to know exactly what they're called... otherwise you have to create the link, then rename the function.

It's much less complicated to just let AGS do all that work for you.
Status: Trying to come up with some ideas...

SMF spam blocked by CleanTalk