Ashley's Forum Posts

  • 3. As the gap between frames starts to get bigger, the delta between frames increases. Because I'm stepping the box2d world by this amount, it's stepping further in the physics world because the delta is larger.

    That sounds like the correct way to do it - you want to step the physics world further when more time has passed since the last tick. I guess there must be a bug in the way you handle ticks.

    I remember having a similar problem with the Physics behavior in Classic: the world needs to be ticked once per tick no matter how many instances there are. The solution is to keep a tick count in the behavior of the last tick number that the world was ticked. runtime.tickcount in C2 gives you the number of ticks that have passed so far, so your tick code per instance is something like:

    if (this.behavior.lastTicked < this.runtime.tickcount)

    {

    tickTheWorld(); // whatever function to advance the physics simulation

    this.behavior.lastTicked = this.runtime.tickcount;

    }

    This way no matter how many instances you have, the entire behavior is only advanced once per tick. I bet it speeds up when you add more instances because more than one instance is advancing the physics.

    ou should add an onDestroy callback sometime as well. It'd be a lot more easier. But thanks for that anyway.

    Isn't that exactly what addDestroyCallback is? Or do you need something else?

  • Use the project bar. Right click the layouts folder to add another layout, and double click a layout or event sheet to open it. You can have as many layouts and event sheets open at once as you like!

  • I think you've just reached 1000 reputation, which means you're trusted now :)

  • That's the one, it's in the default HTML for the next build! That'll fix it for anyone having problems right now, though.

  • Ah, I think I've solved it (thanks to StackOverflow yet again!). The page is being rendered by IE9 in compatibility mode, which means "pretend to be an old browser", which means "pretend you don't have canvas". There's loads of factors to whether or not compatibility mode kicks in, but you can force it to use the correct mode with a HTML tag. Fixed in next build.

  • This is really odd, I'm stumped. I'll look in to it and see if I can find out any more information.

  • You do not have permission to view this post

  • This discussion is irrelevant - people are free to choose the browsers they want. IE9 has far and away the best canvas implementation - it draws with the best quality and is also the fastest. So I really like running Construct 2 games in IE9.

    IE9 supports canvas perfectly, there's no need at all for excanvas. The question is, why isn't it showing the canvas in the link? I guess something in the HTML is invalid and somehow broke it, but I can't find what.

  • You do not have permission to view this post

  • That's odd, I've had a look and can't see anything wrong. I've no idea why IE9 won't show the canvas. Anyone got any ideas?

  • Hopefully this helps:

    To get the time passed for this tick, use

    ar dt = this.runtime.getDt(this.inst);

    dt is the time, in seconds, that the physics simulation should advance. That should keep the speed steady no matter the framerate.

    To get a callback when an instance is destroyed:

    I just remembered there's already a function for this, because other parts of the runtime need it. Call

    untime.addDestroyCallback(function(inst) { alert(inst.toString()); });

    and it will alert the instance ID whenever something is destroyed.

    To get a callback when an instance is moved or rotated:

    There's nothing for this right now, but for the next build I've added a method for instances:

    nstance.add_bbox_changed_callback(function(inst) { alert(inst.toString()); });

    This will alert the instance ID whenever its bounding box is changed (x, y, width, height or angle is changed). Try to only add one callback and only for instances that really need it, because otherwise it'll add unnecessary overhead.

    Hope that helps, let me know if there's anything else you need!

  • —, these are awesome. I'll get those changes in to the engine for the next build.

  • It's somewhere on a very long todo list! If it's quick, I'll see if I can bump it up to the next build.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well it's weird, IE9 definitely can run canvas. I think whoever's game you are running must have made a mistake in the HTML. Could you post a link to it or copy-paste the HTML source here so I can see what they've done? Maybe we can add extra comments to help prevent people doing it again in future.

  • Ah, I made a silly mistake in the animations preview dialog. Fixed in next build, thanks!