Engine Event Model - Documented anywhere?

0 favourites
  • 9 posts
From the Asset Store
Make your dream action platformer game effortlessly with this template!
  • Hi everyone,

    I'm new here, but I'm in love with this tool.

    I'm having trouble, though, with finding things in the manual, because some of the terminology is overloaded.

    For instance, I'm looking for the order that event callbacks happen in the core javascript framework that is used when we export a project called c2runtime.js.

    The "events" as defined by Construct2 on the "System" plugin are

      On loading finished On end of layout On start of layout On canvas snapshot

    I've hooked each one, and occasionally, it appears that "on start of layout" isn't firing in a timely manner, even though I certainly would expect it to. We may be "loading resources" and the engine is bogged down, but I don't see a "On start of loading", or an "On start of game". Scirra guys, this might be handy...

    The Browser plugin has a few more that I've hooked

      On resized On went online On went offline On menu button On search button On update ready On suspended On resumed

    and these seem to be fine, but none of them seem to happen as a 'start-up' event.

    I thought I was golden with System."On start of layout", but sometimes it's several seconds before it actually fires. During this time, I see the layout with all the sprites on it, in their messy positions where I placed them while creating the layout.

    What I'm hoping do to is execute a chunk of stuff PRIOR to the first frame of the layout being drawn on the screen, and only do it once. I want to do some interrogation of the actual window size, and hide/move some sprites and such out of the viewport before the user can see them, and I want to delete ones that don't apply. I have different sized buttons and such for devices with small screens and larger stuff for devices with bigger screens.

    Can anyone offer any hints?

    And, for the guys at Scirra, this really is an excellent product. You should be proud of yourselves.

    -john

  • 'On start of layout' fires before the layout is drawn for the first time, and AFAIK it works fine. If you're seeing something else, post your .capx.

  • Do I post it here? Or upload someplace else and post a link?

    How's that work in these parts?

  • Hi jgordos,

    A dropbox account is recommended. See here:

    scirra.com/forum/topic43676.html

  • Thanks, Mulkaccino!

    Sorry about all the newbie stuff.

    -john

  • Here's a link to the folder.

    dropbox.com/sh/wjt17woiq51zsza/Gy3L8Pg84p

    When it starts, the "Play" button is on the bottom of the browser window.

    Resize the browser by hitting F11... Play comes up 10 pixels...

    Hit F11 again to resize, and Play stays at the new location; go fullsize and it stays put.

    It should be starting at 10 pixels from the bottom... But something about the viewport size stuff is inconsistent.

    -john

  • do you have scroll to player or set size ? I found that scroll to player does wonder but again im not sure on different size resolution. Also you could add the anchor function to the button?

  • Which browser are you using? Everything seems to be working fine in Chrome.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I use Chrome, too.

    Here's what I'm seeing... Check my dropbox again.

    dropbox.com/sh/wjt17woiq51zsza/Gy3L8Pg84p

    In image 1_pressedRunLayout.png, you can see my entire desktop; The preview mode has started in Chrome, and the PLAY button is stuck to the bottom of the layout, just at the top of the black letterbox, and there's just a bit of the black letterbox showing.

    In image 2_pressedRestoreDown.png, I pressed the restore down control in the top of the browswer (two overlapping boxes). You can see the window has resized, the layout has resized, and now there's a nice, fat letterbox around the entire layout. That's exactly like it's supposed to work, I'm sure. The PLAY button has now moved up a bit from the bottom (which is actually what I want. I'm looking to maintain that negative space, so this seems like "correct" behavior to me.

    In image 3_pressedMaximize.png, I pressed the maximize control in the top of the browser. We're back to looking nearly exactly like image 1, except the PLAY button is now nicely maintaining that negative space at the bottom. By that, I mean it's no longer anchored to the top of the letterbox at the bottom. It looks great, frankly.

    And from now on, it actually works like I want and floats nicely above the bottom of the letterbox, regardless of screen sizes. I've done this on several devices (iPad, iPhone, windows PC, windows surface, windows surface RT), and on the PC it seems to work the same in IE9 and Chrome, so it's very, very consistent.

    But it's surprising to me, because the button's location is determined by a function I wrote; the default position for the play button is at the top left of the layout. You can see this in the capx.

    Anybody have any ideas?

    -john

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)