How do I Crush Sprites? [IMG EXAMPLE]

0 favourites
  • 6 posts
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • Hey guys. I'm trying to properly implement crushing sprites. I want to be able to defeat some blob enemies by crushing them with a box. Now I know there are many ways to implement this but I'm trying it against a tilemap surface when the box is approaching the sprite at high velocities. Also, the box should be able to crush it from different angles. Meaning the sprite can also be crushed on the ceiling. Now this is the code I used:

    My problem is illustrated in the picture below.

    While I'm able to achieve the desired results as you can see with the first and second examples:

    At the third example the pink box is also destroyed even if it isn't being crushed but only because it's overlapping the tilemap at an offset when it's the one falling on the metal box. How do I make it so it only gets destroyed when getting crushed?

  • Depending on where the hotspot is, the pink box should always have a greater y than the brown on when they are overlapping.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Dont really understand why it works at all. On collision the squared speed should be close to zero.

    I dont know how many VulneraBox's you have.

    Assuming there are more then one ....

    I would:

    Give the VulneraBox a instance boolean 'CanCrush'.

    VulneraBox > Compare velocity ... overall velocity .. > .. 400

    _______ VulneraBox > Set boolean 'CanCrush' .. true

    VulneraBox > Compare velocity ... overall velocity .. <= .. 400

    _______ VulneraBox > Set boolean 'CanCrush' .. false

    VulneraBox on collision with TM_box

    VulneraBox > Is boolean instance variable set ... 'CanCrush'

    ________TM_box > destroy

  • Depending on where the hotspot is, the pink box should always have a greater y than the brown on when they are overlapping.

    Actually I did consider this. But here's the catch: It's a rotating layout. I'm actually thinking of inserting a decoy sprite to be used as the relative 'higher Y' that keeps its position relative to the viewport.

    I'll have to do some tests.

    Also I forgot there's a 3rd case I just thought of last night:

    For this case I'm thinking of put Tilemap and BOX_METAL inside a family (if C2 allows) and replace the:

    overlapping TM at offset with

    overlapping SOLID_FAMILY at offset.

    Now hypothetically using the hotspot method it should work but I'm anticipating a whole other set of problems.

  • Dont really understand why it works at all. On collision the squared speed should be close to zero.

    Oh actually the illustration isn't clear. In that case, both VULNERABOX and BOX_METAL are sliding down thus both reached the maximum velocity.

  • > Depending on where the hotspot is, the pink box should always have a greater y than the brown on when they are overlapping.

    >

    Actually I did consider this. But here's the catch: It's a rotating layout. I'm actually thinking of inserting a decoy sprite to be used as the relative 'higher Y' that keeps its position relative to the viewport.

    I'll have to do some tests.

    Also I forgot there's a 3rd case I just thought of last night:

    For this case I'm thinking of put Tilemap and BOX_METAL inside a family (if C2 allows) and replace the:

    overlapping TM at offset with

    overlapping SOLID_FAMILY at offset.

    Now hypothetically using the hotspot method it should work but I'm anticipating a whole other set of problems.

    Um layer, or layout rotation don't change object y values, and you still have the same circumstances in the third case

    brown overlaps pink

    -pink has greater y than brown

    It's just a matter of picking

    You can filter that the other way

    brown y is less than pink y

    -brown is overlapping pink

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