Scirra, Cropping images RUINs image poins etc!

Discussion and feedback on Construct 2

Post » Thu Aug 23, 2012 7:33 pm

Thanks shinkan. Its great to hear that its a known bug. I was quite worried that was an intended change, which would have been a horrible idea.
B
46
S
8
G
4
Posts: 414
Reputation: 6,830

Post » Thu Aug 23, 2012 7:41 pm

You can place image points outside the image area. Only the origin and collision polys are bounded to the image area.

I can't recall off the top of my head why origins have to be bounded (I'm sure there was some reason), but it's very important for collision polys: a really huge optimisation in the collision tester is that it can immediately return with a "not overlapping" result if the object bounding boxes do not overlap, which is an almost instant test. If collision polys can go outside the bounding box, all bets are off and every single collision poly point has to be tested. That would be really slow, so collision polys are bounded to the object area.

Collision poly and image points are stored in texture co-ordinates - in other words, if the image size changes, all points and the poly scale accordingly. You probably want to make sure you crop before setting the collision poly, otherwise the collision poly will be scaled down accordingly too.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Thu Aug 23, 2012 7:44 pm

@Ashley - that does not explain why the origin should be bounded.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Thu Aug 23, 2012 9:44 pm

Thanks for the clear explaination, Ashley. That does sound like a worthwhile optimization for most games with lots of sprites checking for collisions. being able to place image points outside the bounding box was the most important to me.

Please though, if there's no good reason, it would be hugely helpful to be able to put even the origin outside the bounding box..there are several animations in my current game project which require this.
B
46
S
8
G
4
Posts: 414
Reputation: 6,830

Post » Thu Aug 23, 2012 10:31 pm

@sqiddster

Yes, if necessary I do a image 3 times bigger than the necessary for the currently frame:



On this image, the origin and any other points are stored inside the image, where I do some sparkling effects.

[quote=Brashmonkey]It is rediculuosly simple math to keep the correct position for image points and for collision shapes while cropping. That is no excuse.[/quote]

Also, you can make masks for your sprites and simple pin the animations on these masks, keeping the collision areas and points on the mask, and using the animations only for animation purposes.

Another question, you're wondering this for the Spriter plugin?
ImageImageImageImageImageImage
B
93
S
20
G
13
Posts: 1,217
Reputation: 18,996

Post » Fri Aug 24, 2012 7:57 pm

No, this is totally unrelated to Spriter.

I use rectangle (mask) sprites to control the player controlled platformer objects, but I dont want have to resort to using two sprites for every single enemy in a level.

I'm satisfied that the image points will b e fixed and will use tricks to get around the collision shape limitations as well.

B
46
S
8
G
4
Posts: 414
Reputation: 6,830

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: pablo7 and 17 guests