How do I create sprite object size of collision polygon?

Get help using Construct 2

Post » Thu Oct 13, 2016 7:22 pm

Hello everybody,

I have an question to ask.

Let’s say I have a sprite object called Sprite1. It’s collision polygon is smaller than image itself. Now I want to create another sprite object called Sprite2 on top of Sprite1.

Next, I want to set size of Sprite2 depending of the collision polygon size of Sprite1. First I thought that setting Sprite2 size by using expression Sprite1.BBoxTop etc. values but it turn out that they refer to the image’s bounding box, not collision polygon bounding box. Which makes totally sense now I think about it :)

So my question is: is it possible to set size of sprite object to match the collision polygon size of another object?

-M-
B
16
S
2
Posts: 60
Reputation: 984

Post » Thu Oct 13, 2016 8:26 pm

Option 1 - Manually set both sprites to the proper size.

Option 2 - Create imagepoints where your collision polygon vertices are. You can refer to these imagepoints' positions, and get the difference between two of them to calculate a width and a height value.

Option 3 - Like option 1, but in case of dynamic sizes you can set the smaller Sprite2 to a percentage of Sprite1's width and height.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458

Post » Thu Oct 13, 2016 9:11 pm

oosyrag wrote:Option 2 - Create imagepoints where your collision polygon vertices are. You can refer to these imagepoints' positions, and get the difference between two of them to calculate a width and a height value.


Yes, That could indeed do the trick. Thank you :)

-M-
B
16
S
2
Posts: 60
Reputation: 984


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests