How do I change the collision based off the effect?

0 favourites
  • 4 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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]

  • 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?

  • [quote:2lqts6av]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

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