Object List

edited August 2012 in Help request
Right now, I'm making some kind of splash animation using objects to load an image on the screen, then make it fade in/out with the FX properties. I also use Scroll.
[Splash]
ChildList	= Orx # EpicMinds

[Orx]
Graphic  = OrxGraphic
Position = (0, 0, 0)
[OrxGraphic]
Texture = ../data/splash/orx_splash.png
Pivot = center

[EpicMinds]
Graphic = EpicGraphic
Position = (0, 0, 0)
[EpicGraphic]
Texture = ../data/splash/epic_splash.png
Pivot = center

I first create the Splash object, and then add the FX in the code. The thing is that it loads both images and apply the effect on them.

Is there any way I can select a child object to load first? Or maybe have the second child wait a little bit before loading it?

Comments

  • edited August 2012
    Yep, the easiest way of doing that without having to write code is to use the timeline tracks. :)

    Something like:
    [Splash]
    TrackList = SplashTrack
    
    [SplashTrack]
    0 = Object.Create Orx
    2 = Object.Create EpicMinds
    4 = Object.Delete ^
    

    Will result in delayed object creation for EpicMinds. Keep in mind that when you do this, Splash won't be the parent of neither Orx nor EpicMinds (and in this example when Splash is deleted at time = 4, both objects will remain) so if that's important for you you can still use commands such as Object.SetParent/Object.SetOwner, like this:
    [Splash]
    TrackList = SplashTrack
    
    [SplashTrack]
    0 = >> Object.Create Orx # Object.SetParent < ^ # Object.SetOwner < ^
    2 = >> Object.Create EpicMinds # Object.SetParent < ^ # Object.SetOwner < ^
    4 = Object.Delete ^
    

    You can of course have different FXs on objects, different lifetimes, etc to achieve exactly what you want.
  • edited August 2012
    Wow it works, thanks!
    I didn't know you could add code like that into inis. I remember seeing it in MushroomStew files, but that's it. Is there any way I can learn more about the code I can use inside inis? Any specific syntax? It doesn't look like anything I know or would do.
  • edited August 2012
    It's actually not that old! :)

    It's the combination of two recent modules: timeline that allows to define sequences of events sent over time and commands which can intercept those events and link them to internal commands.
    New commands can also be added at runtime by the user or interpreted directly. It'll be the base for a console module that I haven't started yet.

    Here's the thread that started it all 3 months ago: https://forum.orx-project.org/discussion/3955

    I've been using timelines/commands a lot lately for making a generic UI system that a friend and myself are using in our current game made with orx/scroll. He's making all the buttons/menus/tutorials via config using commands like this.

    There's no easy way to know the list of available commands right now unfortunately beside having a look at the code, but you can look into these files: orxObject.c, orxConfig.c, orxLocale.c and orxMouse.c and look for functions ending with _RegisterCommands().

    I'll soon add the option to query commands at runtime and probably a new wiki section.
  • edited August 2012
    I think I know how to make it work now. I still get a few errors, not sure why, but it works as I intended it to work.

    You can try my fade tests here:
    http://webfiles.mhyre.com/orx/fadetest.zip (1,68 MB)
  • edited August 2012
    I looked at it and I think there should be a small x in AddFx function. I changed it and debug errors disappeared.
  • edited August 2012
    Well actually, Reemon, the real syntax is AddFX, with upper case X. It complains because the list of parameters for the command doesn't match the prototype and let us know that the first argument, FX-Fade isn't the right type (it should be an object GUID, not the FX).

    If you use a lower case x, the event doesn't match to a command at all, so the command module doesn't try to evaluate it and won't complain, hence no error displayed in that case.

    Here's what you currently have, Mhyre:
    [SplashTrack]
    0 = >> Object.Create BlackSplash # Object.Delete < ^ #
        >> Object.Create OrxSplash # Object.AddFX FX-Fade # Object.SetParent < ^ # Object.SetOwner < ^
    5 = >> Object.Create EpicSplash # Object.AddFX FX-Fade # Object.SetParent < ^ # Object.SetOwner < ^
    10 = Object.Delete ^
    
    Which translates to:
    - Create object BlackSplash and push it twice (on the stack)
    - Pop it and delete it (with an extra parameter that won't be interpreted: ^)
    - Create object OrxSplash and push it twice
    - Object.AddFX with wrong parameter
    - etc...

    So in addition to the incorrect AddFX, you also delete the BlackSplash as soon as it's created and you keep its GUID on the stack (pushed twice, popped once).

    Here's probably what you want:
    [SplashTrack]
    0 = >> Object.Create OrxSplash # Object.AddFX < FX-Fade # Object.SetOwner < ^
    5 = >> Object.Create EpicSplash # Object.AddFX < FX-Fade # Object.SetOwner < ^
    10 = Object.Delete ^
    

    Or, even simpler, by using regular object config properties:
    [SplashTrack]
    0 = > Object.Create OrxSplash # Object.SetOwner < ^
    5 = > Object.Create EpicSplash # Object.SetOwner < ^
    
    [OrxSplash]
    FXList = FX-Fade
    
    [EpicSplash]
    FXList = FX-Fade
    
    [Splash]
    LifeTime = 10
    
  • edited August 2012
    iarwain wrote:
    Here's what you currently have, Mhyre:
    [SplashTrack]
    0 = >> Object.Create BlackSplash # Object.Delete < ^ #
        >> Object.Create OrxSplash # Object.AddFX FX-Fade # Object.SetParent < ^ # Object.SetOwner < ^
    5 = >> Object.Create EpicSplash # Object.AddFX FX-Fade # Object.SetParent < ^ # Object.SetOwner < ^
    10 = Object.Delete ^
    
    Which translates to:
    - Create object BlackSplash and push it twice (on the stack)
    - Pop it and delete it (with an extra parameter that won't be interpreted: ^)
    - Create object OrxSplash and push it twice
    - Object.AddFX with wrong parameter
    - etc...

    So in addition to the incorrect AddFX, you also delete the BlackSplash as soon as it's created and you keep its GUID on the stack (pushed twice, popped once).

    Here's probably what you want:
    [SplashTrack]
    0 = >> Object.Create OrxSplash # Object.AddFX < FX-Fade # Object.SetOwner < ^
    5 = >> Object.Create EpicSplash # Object.AddFX < FX-Fade # Object.SetOwner < ^
    10 = Object.Delete ^
    

    The problem I had was that the orx splash image was showing up really fast before the fade FX would kick in, which is why I was loading then deleting the black splash object, which is just a black image. I didn't even see I pushed it twice :p
    Or, even simpler, by using regular object config properties:
    [SplashTrack]
    0 = > Object.Create OrxSplash # Object.SetOwner < ^
    5 = > Object.Create EpicSplash # Object.SetOwner < ^
    
    [OrxSplash]
    FXList = FX-Fade
    
    [EpicSplash]
    FXList = FX-Fade
    
    [Splash]
    LifeTime = 10
    

    That looks much more efficient to me. Does the lifetime property imply that the Splash object will be deleted automaticly?

    EDIT: I guess it does. Now I only have a few problems with using "CreateObject" in classes, to switch from the splash screen to the actual menu, and do more things later on.
  • edited August 2012
    You are right about LifeTime.
    Any details on the problems you have?
  • edited August 2012
    I can't create any object into any class other than the main one.

    OrxScroll is the main class, includes Scroll.h
    Splash is the splash screen class, includes OrxScroll.

    I can send you the project if you want, but Splash is a public ScrollObject, and I can't do anything with it. I'd like to create the menu object in the OnDelete callback of the splash object.
  • edited August 2012
    Sure, don't hesitate to PM/email me your project, I'll have a look.
Sign In or Register to comment.