Suggestion: Object type - Trigger

Discussion and feedback on Construct 2

Post » Mon Apr 22, 2013 2:09 am

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?
B
18
S
5
G
1
Posts: 95
Reputation: 2,666

Post » Mon Apr 22, 2013 6:12 am

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?
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Mon Apr 22, 2013 2:23 pm

Just make a 32x32 sprite and stretch it really big. The image data will be negligable (4096 bytes decompressed).
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Mon Apr 22, 2013 3:01 pm

@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?
B
9
S
3
G
4
Posts: 63
Reputation: 3,083

Post » Mon Apr 22, 2013 3:56 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Mon Apr 22, 2013 4:14 pm

@Ashley - Thanks, that makes a lot of sense...
B
9
S
3
G
4
Posts: 63
Reputation: 3,083

Post » Tue Apr 23, 2013 2:41 am

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.
B
58
S
20
G
7
Posts: 305
Reputation: 8,804


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests