How do I change the collision based off the effect?

Get help using Construct 2

Post » Thu Oct 06, 2016 3:41 am

I have a Sprite that is a circle, then I gave it the Pixellate effect, making it look like 3 squares put together, but it still has the collision box of The circle sprite from before the effect was applied. Is there a way I can fix this?
*Insert Signature here*
B
13
S
5
Posts: 73
Reputation: 1,090

Post » Thu Oct 06, 2016 4:40 am

The effect will only change how your sprite is displayed, it won't change its collision box.
One way to implement your idea is to add a second animation (using the same sprite), and changing the collision box of the second animation to match what you need.
The event will look something like this:
On collision -> Set Sprite animation to [second animation]
B
29
S
10
G
10
Posts: 97
Reputation: 6,614

Post » Thu Oct 06, 2016 5:21 am

makotto wrote:The effect will only change how your sprite is displayed, it won't change its collision box.
One way to implement your idea is to add a second animation (using the same sprite), and changing the collision box of the second animation to match what you need.
The event will look something like this:
On collision -> Set Sprite animation to [second animation]


But then, That would leave less creativity in what I am doing. It is supposed to be that it randomly chooses a number and set it as how "pixelated" that object is. Unless you expect me to add a couple of hundred different animations for each possibility, there should be an easier way?
*Insert Signature here*
B
13
S
5
Posts: 73
Reputation: 1,090

Post » Thu Oct 06, 2016 12:54 pm

But then, That would leave less creativity in what I am doing. It is supposed to be that it randomly chooses a number and set it as how "pixelated" that object is. Unless you expect me to add a couple of hundred different animations for each possibility, there should be an easier way?


Okay, that is new constrain you did not mention on the original post. The first issue is that, as far as I understand, it is not possible to change the size of the collision poly during run time (if I'm wrong on this, can anyone please let me know?).

By the way, it is hard to give you an answer without a capx. This may work: disable collisions in the sprite that gets pixelated, and pin a transparent sprite to it (position and and angle), at beginning of the layout. then at each collision:
on collision -> set variable temp to a random number
apply pixellate with temp as parameter
set [invisible sprite] height to a size based on the pixellate parameter
set [invisible sprite] width to a size based on the pixellate parameter
pin [invisible sprite] to [pixellated sprite] (position and angle
B
29
S
10
G
10
Posts: 97
Reputation: 6,614


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 27 guests