Suggestion: Object type - Trigger

  • So typically when I want to trigger an event when the player reaches a certain point (ie. when the player reaches this point, something tries to fall on them, or using it to detect when the player goes through a "door" in a sidescroller and changes layouts) I need to make an invisible sprite to detect this. Which is all fine and dandy and works very well, but with a sprite comes image data.

    I'm wondering mostly if having a Trigger object (which would basically be a sprite but with no image data attached) would be more useful than creating what are essentially "trigger sprites"? How much does a sprite's image data affect anything when it's invisible?

  • Without an image you would basically need to get just an X,Y coordinate of the sprite. So can't you just put a compare two variables event that runs every tick and checks to see if the players X,Y coordinates are within a particular range thereby being in your trigger zone?

  • Just make a 32x32 sprite and stretch it really big. The image data will be negligable (4096 bytes decompressed).

  • Ashley - is there any reason to not use an even smaller sprite? Is there a performance hit for scaling over a certain size, for example?

  • It probably makes no difference at all, since whether you save 4000 bytes or 400 bytes in a game which likely uses 10mb+ of other images will simply have no effect. 32x32 is also easy to see in the image editor (it doesn't disappear to a tiny dot) and tiny images just a few pixels across can sometimes have extreme linear filtering artefacts at the edges which make them seem really blurry. So it's not very important, but it might be a bit more convenient.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley - Thanks, that makes a lot of sense...

  • I always use a 16x16 sprite myself and set it as 'invisible', since collisions will still work. That way I can stretch them over an area but not have them interrupt the feng shui of the stage. Also, since they're invisible, blurring won't matter. Instance variables take care of ID purposes in the event sheets.

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