How do I break those bricks

Get help using Construct 2

Post » Mon Jul 21, 2014 3:46 pm

I'm using tilemap, how do i "break" my bricks on collision?
pic related
what i'm trying to achieve:
Image
my tilemap:
Image

edit:damn, this forum is slow
B
4
S
1
G
2
Posts: 58
Reputation: 1,016

Post » Mon Jul 21, 2014 5:30 pm

anyone?
B
4
S
1
G
2
Posts: 58
Reputation: 1,016

Post » Mon Jul 21, 2014 6:04 pm

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.
B
11
S
3
G
1
Posts: 98
Reputation: 1,062

Post » Mon Jul 21, 2014 6:07 pm

Robsta wrote: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"
B
4
S
1
G
2
Posts: 58
Reputation: 1,016

Post » Mon Jul 21, 2014 7:00 pm

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.
B
11
S
3
G
1
Posts: 98
Reputation: 1,062

Post » Mon Jul 21, 2014 7:11 pm

Robsta wrote: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
B
4
S
1
G
2
Posts: 58
Reputation: 1,016

Post » Mon Jul 21, 2014 7:13 pm

Yes, that's why I said it suggested that you just use sprites instead of a tilemap for the breakable tiles.
B
11
S
3
G
1
Posts: 98
Reputation: 1,062

Post » Mon Jul 21, 2014 9:08 pm

btw, how do i prevent breaking bricks from sides?
B
4
S
1
G
2
Posts: 58
Reputation: 1,016

Post » Mon Jul 21, 2014 9:33 pm

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).
B
11
S
3
G
1
Posts: 98
Reputation: 1,062

Post » Mon Jul 21, 2014 10:23 pm

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..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: David181, Shenkai the ssj and 22 guests