How do I break those bricks

0 favourites
From the Asset Store
Template for a bricks 'n ball game, fully documented in comments and video
  • I'm using tilemap, how do i "break" my bricks on collision?

    pic related

    what i'm trying to achieve:

    my tilemap:

    edit:damn, this forum is slow

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • anyone?

  • Well I haven't done much with using a tile map in relation to a real time game (yet), but if you can detect collision then you could turn the tile into a different tile, one which has a semi-broken, or broken look to it.

    You can also remove the tile and place a sprite there to display a breaking animation.

  • Well I haven't done much with using a tile map in relation to a real time game (yet), but if you can detect collision then you could turn the tile into a different tile, one which has a semi-broken, or broken look to it.

    You can also remove the tile and place a sprite there to display a breaking animation.

    Well, that should be a way to detect collision tile and replace it, instead of "hardcoding"

  • I'm not suggesting anything that I would consider hardcoding.

    If you have a lot of tiles that are breakable on collision, you could put another tilemap on top of your existing tilemap and test collisions with it, then transfer the actions over to your displayed tilemap. (Presumably they'd both have the same tile size and tilemap size, so the tile location would be the same.

    Of course the https://www.scirra.com/tutorials/313/cl ... deo/page-1 tutorial just suggests you make all the breakable tiles sprites.

  • Of course the https://www.scirra.com/tutorials/313/cl ... deo/page-1 tutorial just suggests you make all the breakable tiles sprites.

    that "tilemap" there is fake one, that's just a bunch of copies of brick sprite copied over and over again

  • Yes, that's why I said it suggested that you just use sprites instead of a tilemap for the breakable tiles.

  • btw, how do i prevent breaking bricks from sides?

  • Now that's the hard part, collision means the objects are overlapping, meanwhile you could check relative positions, that presumes that you'll never have any tunneling problems. (This will work if your frame rate is high and your player moves slowly). However, another way to check is by checking the player's velocity at the time of the collision.

    You could just try checking Player.Platform.MoveAngle > 180 (This should make it so that you can only break bricks while moving upwards).

  • You could use a sprite above the head of the character and use that as detection..

    If that sprite is overlapping the brick - destroy brick..

    That way you could also do it with tilemap, for you can choose the tile it is overlapping by using PositionToTileX and PositionToTileY..

  • You could just try checking Player.Platform.MoveAngle > 180 (This should make it so that you can only break bricks while moving upwards).

    please, reference construct nodes

    p.s. it can also happen, that player can break >1 brick at once (vertically), how to fix that as well?

  • I'm not really sure what you want/mean, but if you could clarify yourself or provide a capx with the issue it would be a lot clearer and easier to comment..

  • I'm not really sure what you want/mean, but if you could clarify yourself or provide a capx with the issue it would be a lot clearer and easier to comment..

    here you go

  • Too bad, you are using a plugin I don't have and use (platform+), so I won't be able to open the caproj/capx..

    My best bet would still be to delete the tile from the tilemap overlapped by a collisionsprite pinned to the player and create an animated destruction-sprite at that position..

  • Too bad, you are using a plugin I don't have and use (platform+), so I won't be able to open the caproj/capx..

    it isn't so hard to download and install it

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