How do I erase tiles on collision with a bullet Please Help

Get help using Construct 2

Post » Fri May 05, 2017 10:23 pm

Hello,

In my game I have a bullet, and I need it to where when I hit a tile with my bullet, it erases. I have been trying at this for several hours, I have read the manual, and scoured google for forums on this. I can not find anything

My events go like this:
ball: On collision with Tile map > Erase tile (TilemapOneTouch.SnapX(Ball.X),TilemapOneTouch.SnapY(Ball.Y))

Please help me

Thank you so much for your time,
Ian
B
22
S
7
G
1
Posts: 90
Reputation: 2,045

Post » Sat May 06, 2017 2:49 am

add the event "bullet your using" on collision with "target your using" and add the action destroy "bullet your using" and destroy "target your using" you need to have them as separate sprites
B
9
S
5
G
8
Posts: 12
Reputation: 4,920

Post » Sat May 06, 2017 4:44 am

@cori6r87

Hello, thank you for your response, but I don't think this will work because I am needing to use a tilemap and my bullet does not need to be destroyed.

Is there any way in which what you are talking about could be modified?

Thank you, ian
B
22
S
7
G
1
Posts: 90
Reputation: 2,045

Post » Sat May 06, 2017 6:31 am

you need to have all the pieces you want to be destroyed as separate sprites this is an example: https://drive.google.com/open?id=0B0zF1 ... FlaaWxtdGs

open and run it, then look at the event sheet,

this is an example of how the tilemap works.

this is another example: https://drive.google.com/open?id=0B0zF1 ... FlaaWxtdGs
Last edited by cori6487 on Sat May 06, 2017 7:21 am, edited 3 times in total.
B
9
S
5
G
8
Posts: 12
Reputation: 4,920

Post » Sat May 06, 2017 6:43 am

IanHarlow wrote:@cori6r87

Hello, thank you for your response, but I don't think this will work because I am needing to use a tilemap and my bullet does not need to be destroyed.

Is there any way in which what you are talking about could be modified?

Thank you, ian


you need to use sprites not the tilemap
B
9
S
5
G
8
Posts: 12
Reputation: 4,920

Post » Sat May 06, 2017 12:40 pm

cori6487 wrote:
you need to use sprites not the tilemap


I am sorry but that is not correct:

https://www.dropbox.com/s/bfwr6zs8mmzaf ... .capx?dl=1

Shoot at a cactus. Press the button to generate a new map when out of cacti to shoot. The collision polygon is a bit too small on them so it mail fail occasionally, that can be changed in the tilemap tools in the C2 editor.

That is one way to do it with just one tilemap, although for best performance I recommend using two tilemaps. One without collisions for most of the grapics and the other with collision for just the destroyable tiles. This is because only empty tiles do not have collision masks (it is not possible to disable collisions for specific tiles), therefore like in the example I linked to above, the "on collision" event will trigger every tick. If you would disable the second condition of the on collision event in my example which checks what tile the projectile collided with, the bullet would erase the tile on which the player is standing.

I use something similar for LOS with walls, walls are a separate tilemap from the surface and have collisions plus solid behaviour.
B
15
S
6
Posts: 85
Reputation: 1,195

Post » Sat May 06, 2017 4:04 pm

@pulstar

Hello,
Thank you for your reply. This is exactly what I needed!

But then I put it into Construct 3, it does not work. Do you know why this is?

Thank you,
Ian
B
22
S
7
G
1
Posts: 90
Reputation: 2,045

Post » Sat May 06, 2017 8:46 pm

IanHarlow wrote:@pulstar

Hello,
Thank you for your reply. This is exactly what I needed!

But then I put it into Construct 3, it does not work. Do you know why this is?

Thank you,
Ian


it might just be because c3 isnt complete
B
9
S
5
G
8
Posts: 12
Reputation: 4,920


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], tarek2 and 13 guests