[Solved] Weird Issue With Sprite & Tiles

0 favourites
  • 15 posts
From the Asset Store
Each tile 64 by 64 pixels - Ultimate Tile Set for your awesome games
  • It may sound confusing but please bear with me.

    I have made two different enemies on my platformer game. One with "Tiles Background" and the other one with "Sprite". When the player collides with each of them, The player should die and it works as expected. No issue is here.

    But the issue occurs when the player collides both of them at the same time, After this when the player collides with other enemies The player not dying at all. Why?

    Please check this .c3p

    Note:

    *It is not happening every time, I thought it might be the issue with Collisions but no.

    *I somehow managed to replicate the issue with the attached c3p.

    *On the attached .c3p I have created a circumstance when you preview the game, the player collides with two different enemies at the same time afterwards when the player collides with other enemies The player will not die at all.

    *When you preview the game and move the player little bit, The said issue will not be produced.

    Update 1:

    I tot it only happened with Tiles background and Sprite but the thing is the same issue can be produced on only with sprite.

  • The only weird thing about this is that you are using a Tiled Background as an enemy. The Tiled Background is for a background, it doesn't have a collision box that you can edit.

  • The only weird thing about this is that you are using a Tiled Background as an enemy. The Tiled Background is for a background, it doesn't have a collision box that you can edit.

    Okay, I can understand, I should use sprite as an enemy, But on my particular setup, the enemy of my game is a STICK type and using tile for this is easier than to use a sprite.

    Cant we fix it? It is a genuine issue?

  • I'm not really looking at the issue because it seems silly to do an on collision event with a background. You should use a sprite plugin for all enemies and there's no disadvantage to doing so, I don't understand the reasoning about stick type.

  • if you really wanted to use tiles for this my not just just a tile map instead? tilemaps support collision

  • What is going on here? No do not use a tilemap object for an enemy in a platformer lol

  • > The only weird thing about this is that you are using a Tiled Background as an enemy. The Tiled Background is for a background, it doesn't have a collision box that you can edit.

    Okay, I can understand, I should use sprite as an enemy, But on my particular setup, the enemy of my game is a STICK type and using tile for this is easier than to use a sprite.

    Cant we fix it? It is a genuine issue?

    Just make a black square sprite and stretch it?

  • 619_RM

    I think the problem is in your condition to check for the player's health.

    Currently the check is PlayerLife = 0.

    This works fine for one collision at a time, because they are set to Subtract 100 from PlayerLife and the initial life is Set PlayerLife to 100, so after a single collision, the health value will sit right at 0 and the condition will be met. If more than one collision takes place in the same tick it will stop working because the player's health will go bellow 0 before it is checked again.

    So I think your problem will be solved if you check for PlayerLife <= 0 (less or equal). That way no matter how much bellow 0 the health goes, the condition will still be met.

  • I'm not really looking at the issue because it seems silly to do an on collision event with a background. You should use a sprite plugin for all enemies and there's no disadvantage to doing so, I don't understand the reasoning about stick type.

    I tot it only happened with Tiles background and Sprite but the thing is, the same issue can be produced on only with sprite.

  • 619_RM

    I think the problem is in your condition to check for the player's health.

    Currently the check is PlayerLife = 0.

    This works fine for one collision at a time, because they are set to Subtract 100 from PlayerLife and the initial life is Set PlayerLife to 100, so after a single collision, the health value will sit right at 0 and the condition will be met. If more than one collision takes place in the same tick it will stop working because the player's health will go bellow 0 before it is checked again.

    So I think your problem will be solved if you check for PlayerLife <= 0 (less or equal). That way no matter how much bellow 0 the health goes, the condition will still be met.

    WOW! It works. ..Thank you so much.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The only weird thing about this is that you are using a Tiled Background as an enemy. The Tiled Background is for a background, it doesn't have a collision box that you can edit.

    That's nonsense, it depends on the obstacle type, if full square collision is valid for the obstacle, then there's nothing wrong with checking collision with it.

    I use it to make stretching walls or lasers, lava and more...

  • > The only weird thing about this is that you are using a Tiled Background as an enemy. The Tiled Background is for a background, it doesn't have a collision box that you can edit.

    That's nonsense, it depends on the obstacle type, if full square collision is valid for the obstacle, then there's nothing wrong with checking collision with it.

    I use it to make stretching walls or lasers, lava and more...

    It's possible to use it for that but you cannot edit the collision box and it's a bit weird because it's supposed so be something in the background. My issue was that he was using it for an enemy, for this it's better to use a sprite with behaviours.

  • i don't see why you have to limit yourself to a sprite? using a sprite might make thinsg easier in some case (animations, editable bounding box, solid collision) but using a tiled background is pretty valid if you have the right use case for it. i mean it's just a tileable sprite without some of the functionality ? just cause it has background in the name does not mean it has to be exclusively in the background? you can use it health bars and a ton of other stuff (non background) ?

  • i don't see why you have to limit yourself to a sprite? using a sprite might make thinsg easier in some case (animations, editable bounding box, solid collision) but using a tiled background is pretty valid if you have the right use case for it. i mean it's just a tileable sprite without some of the functionality ? just cause it has background in the name does not mean it has to be exclusively in the background? you can use it health bars and a ton of other stuff (non background) ?

    Again I'm not talking about UI, I'm referring to its use as an enemy. Hes using a tiled background as an enemy and someone suggested to use the tilemap object as an enemy, I don't think that's great but that's my opinion.

  • Sprite, Tiled Background, Tilemaps and even Drawing Canvas, can be thought as only graphical representations for the objects in a game. So it really doesn't matter how you are using them as long as they draw what you want where you need it.

    The names might imply they are meant for certain tasks only, but if they work for a particular need, it should be just fine to use what ever you feel like. Of course if you need frame by frame animations, I highly recommended you use the Sprite plugin over some other dubious method.

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