Coin-coin le Canapin's Forum Posts

  • Maybe you can take a look at this, it may be useful (or maybe not, but that's still a good thing to know

  • I did some tests and it appears that with the physics behavior, a projectile will bounce without overlapping the tile so in this case your solution won't work.

    While using the physics behavior, I managed to target the closest tile on my project -with the surrounding tiles thing- but I increased the projectile speed and now it's less accurate.

    Most of the time it works :

    [attachment=0:1mxo79dp][/attachment:1mxo79dp]

    Some of the surrounding tiles (under the blue overlay square) aren't empty so I can target a closest non empty tile when the projectile collides with the wall. The red square is the returned tile from the projectile position with positionToTile.

    But sometimes, quite often, it won't work with my fast projectile :

    [attachment=2:1mxo79dp][/attachment:1mxo79dp]

    The tile returned from the projectile coordinates is one tile farthest from the green wall than it should be.

    No surrounding tiles are overlapping the green wall so my events won't work because it needs to target a close non empty tile.

    I avoided this new issue by increasing the radius of the tested surrounding tiles from 1 square :

    [attachment=1:1mxo79dp][/attachment:1mxo79dp]

    Now I can find the closest tile that is not empty.

    That's an ugly solution thought

  • Can you share your capx ?

  • Do you think it works with phycics behavior where, I think, the bullet wouldn't overlap the tiles but just collides with it ?

  • Well, neither of your instructions work for me. What could I do wrong ?

    edit : nevermind, found it.

  • Well I think i managed to do it after too much hours because my brain can't handle so much X and Y.

    http://canapin.com/construct/tolilo/10/

    On a collision, it tests every tile in a square of 1 tile around the tile at impact if they are not empty (blue squares).

    Then it tests the distance between these tiles and the tile at the impact. The shortest distance leads to the closest tile (red one).

    I used dummy sprites instead of directly using the tiles data (X and Y) because it was easier for me to understand how it works visually.

  • So, nobody has an idea how to get the right tile on collision ?

  • How dumb I am.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi,

    On my capx, standard phycic behavior seems to be more accurate than chipmunk regarding collisions. What did I do wrong ?

    http://canapin.com/construct/tests/physicstiles/

    [attachment=0:2zggrgmn]physicstile.png[/attachment:2zggrgmn]

    [attachment=1:2zggrgmn]physicstile.capx[/attachment:2zggrgmn]

  • Thank you.

  • I have a similar problem here : http://canapin.com/construct/tolilo/09/

    Left click to shoot (X if you have a plugged in gamepad).

    The bullet is supposed to bounce of the green tiles, but sometimes it targets the next tile.

    Plus, the bullet and the tilemap having a physic behavior, sometimes the bullet bounces of a tile but the event "bullet on collision with tile" is not triggered, that's why it sometimes bounces on purple tiles even if it shouldn't.

    [attachment=0:37q04z5p]targettiles.png[/attachment:37q04z5p]

    (event 2 tests if it is a green tile)

    What should I do ?

  • Hi.

    I would like to erase a lot of tiles in the editor. There is a rectangle tile editor but I think it can be only used to draw tiles, not to erase them.

    Any quick way to do this ?

  • Works well, thanks

  • Amazing, thanks !

  • That's cool.

    Do you know why the overlap events is faster than the collision one ?

    Aside from this, I made three tests about my stuff with tiles (6480).

    When the left mouse button is down, it constantly destroys the tiles in a 6 tiles radius and set a timer for each tile, which value depending how far the tile is from the mouse coordinates.

    1) Only with a small array : I fill an array when clicking and set my timers in it. When a tile respawns, its reference is removed from the array. Worst performances.

    2) With sprites spawned only when a tile is destroyed. Sprites contains each destroyed tiles timer and they are picked up regarding their XY coordinates (the same as the current tile). Bad performances, not as much as the array solution.

    3) With sprites as the previous ones but with a big array, as the sprites UID are stored in it and so they are picked up by UID. Excellent performances.