How do I AUTO delete only yellow line/ or trap of tilemap?

0 favourites
  • 8 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Hello all, im working on trying to delete the yellow line trap in my game if the player does not make the line connect. I manage to actually get the line and box trap to delete when an enemy is trapped in the box, IF the enemy is overlapping the purple tilemap. But im trying to get it to delete when the player does not make a complete connecting trap AND if the player does make a connecting trap, if there are no enemies in the trap, it will auto delete. But im having difficulty trying to execute this. Would anyone know how I could get the line to delete if it does not make a connecting trap and if it does make a connecting trap, delete if no enemies are not checked in it? Would really appreciate the help!

    Auto delete if line doesnt connect or make a connecting trap

    Auto delete if line did make connecting trap, but no enemy is trapped inside

    Events for tilemap. On event 28. I got it to auto-delete but it deletes too fast and not the way I would like it for it to auto delete.

  • Hard to tell what you're asking, because it looks like you have it all working well.

    Have you looked at an overlap condition for when the tiles turn blue?

    If the enemy is overlapping do x, if not do y?

  • Hard to tell what you're asking, because it looks like you have it all working well.

    Im asking how can I auto delete the line or trap if 1. it doesnt connect to make a full trap and 2.it does connects and makes a full trap , but no enemies are inside. That's why I posted the pics so people could get an idea of what im talking about or trying to achieve.

    Have you looked at an overlap condition for when the tiles turn blue? If the enemy is overlapping do x, if not do y?

    That's what I already have for event 27. If the enemy is overlapping the blue tile when its trapped, destroy enemy and it deletes the trap, setting the tilemap normal. I got that down. What im trying to do is make the lines or trapped auto-delete if 1. line doesn't connect to make a trap and 2. If it does, but no enemy is inside, delete the tilemap/erase tilemap. that's what im having trouble trying to figure out.

  • Good to see you are making progress with this project :)

    For the second part, deleting the tiles if there are no enemies trapped in the completed section. After flood filling the area within a closed section, use a for each enemy loop and check the tile states at their position. If there are none overlapping the purple tiles then you can reset the purple and yellow tiles back to black.

    You should be able to reverse engineer your code that handles the flood fill to determine if there is not a closed section.

  • For part 1 - I'm going to assume your flood fill algorithm continues until it reaches a yellow tile.

    Similarly, you can add an event to stop the fill function and call the clear function if your flood fill algorithm reaches an edge or boundary, which you can define.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Similarly, you can add an event to stop the fill function and call the clear function if your flood fill algorithm reaches an edge or boundary...

    I kinda understand what you mean but im not sure how that would work for part 1. But I think I got a way of how I can get the line to auto-delete by making a point mark for them. For ex, there will be a point A and B sprite. Player will spawn point A on the press of the key of drawing the line trap. On key release, Point B will spawn, but if Point B is not overlapping Point A, set tile (0,0) 100x100 to tile 0 ( back black to what it was).

    Good to see you are making progress with this project :)

    Thanks! Im getting there!

    For the second part, deleting the tiles if there are no enemies trapped in the completed section...

    Thanks for your help and advice for this. I will try it out to see if it works

  • calminthenight

    So im back and I found many events that work, I also used your suggestion, but it deletes too fast to even process the line or even make a trap.

    My problem now is trying to figure out a way of making them delete reasonably and check if the trap has no enemies. Thanks once more though for your help

  • Yes! I got it to work now using the Time Behavior. It's kinda janky, so I still got to do a little editing to make it smoother. but I got it to finally delete when there's no full connected trap or if it is a full connected trap but no enemies are in it, delete itself when necessary.

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