Footguns & quirks

Every language and game engine has its quirks and WTF moments. Here's a list of potential footguns I came across while working in Construct.

Picking instances

A good amount of bugs I create are related to screwing up picking conditions: either picking something I don't want to pick, picking the wrong instance or failing to pick something. Here are some suggestions and known footguns related to object instance picking.

  • If you only want to pick a single object, make sure that the conditions only pick one. If unsure, add a "pick nth instance" condition with the parameter "0".
  • If you're storing UIDs in (instance) variables, make their default value a negative number (eg. -1) and not 0, since 0 could be a valid UID since it's zero indexed. To reset such a variable, you can use any negative number (I use the previously mentioned global constant called NOTHING, which has the value -1).
  • The Timer behaviour's "On timer" condition might pick multiple instances if those instances reach their time in the same tick. In this case an extra "For each" condition is needed to run actions on all of them. This is mentioned in a big yellow warning box in the docs, but the Construct editor has no such warning.
  • Functions and custom actions have a similarly named option: "copy picked" and "copy all picked". If you have a custom action for an object type or family "X" and call it from an event that already picked some instances of "X", those will be passed on to the custom action even if you don't check "copy all picked" (which is for passing other non-"X" instances to the custom action). This is by design and makes sense, but can be slightly confusing
  • If you use a condition to pick certain objects, placing an "else" condition after it won't pick all the other instances of the relevant object. [todo expand, parent pick, inverse pick, etc]

Physics behaviour

The Physics behaviour in Construct 3 is powered by the industry standard Box2D library and it comes with a few quirks. I highly recommend reading through the official docs on the Physics behaviour, especially if you're considering using Physics on objects that might interact with other objects with different movement behaviours, the Solid or Jump-thru behaviours.

You might also notice that objects with Physics behaviour have a little extra padding around their collision polygon, which is especially noticeable on lower resolutions (eg. a ball might look it's hovering above a surface even though it's "on it").

Other stuff

  • The int() system expression works like floor() and does not work like parseInt in JavaScript. If you pass it -0.1, it will return -1 instead of 0. There is a related feature request here with more info workarounds.
  • HTML5 exports can utilize Construct's nifty "offline mode" which uses the Service Worker API to cache files locally once they are loaded. If your offline-enabled HTML5 export loads from an URL and you update your project (without changing the URL) an additional browser refresh is needed to run the latest version and this is by design. After an update and a refresh, Construct's service worker downloads the new version in the background while loading the old version. The new version will run at the next refresh. Projects hosted on Itch.io are not affected by this, since Itch.io actually hosts every new build on a different URL which is embedded in an iframe on your project's Itch.io page.
This article was updated on