How do I Stop an Object at First Pixel Collision?

0 favourites
  • 6 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • While the bullet speed is 50 everything is ok

    But while the bullet speed is 400 the objects are overlapping like this

    I want to stop the object while the bullet speed is 400 like the first image.

    How can i do this?

  • Unfortunately you can't. However if you search the forums there are several workarounds for the issue. None of them are perfect but you'll likely find one that works in your specific situation.

  • Ok,thank you

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe this tutorial will help:

    https://www.scirra.com/tutorials/973/pi ... th-bullets

  • place bullet origin to right side of image ... then measure for its x position or distance from bullet position to the target bboxleft in your case it should detect the collision on the neck of 1 pixel.

    however, you have to keep in mind, that for each machine the game runs, different game behaviors and performances will happen, you cant expect on a old rig to get the best performance as on a top edge PC same applies to mobile, the users experience is as good as their hardware, you can only build the game for a recommended HARDWARE specification. no1 will expect the game to run perfect on a Macintosh for example the '84 released one!

    that means, even if you get the collision on ur pc on 1 pixel distance, others might not get it as you!

    what you need to do to avoid that! is used in multiplayer prediction system! where you take in calculation the PING user has/ in this case you have to take in consideration the machine cpuutilisation and FPS it runs at/ then predict when the collision wold happen, and make it happen 1/10 of a time faster.

    even so why wold you need pixel perfect collision on a game? you can fake the perfect collision with visuals, no player will notice it!

    the tutorial Asmodean suggested could fix your issue, but will raise others and complicate more things that i bet your game is based on solids and bullets. which you wont be able to deprecate the usage of the behaviors, just because of the pixel perfect issue!

    real question is: Is the 1 pixel collision really that important in the gameplay your building?!

    P.S personally never seen a 1 pixel collision system that works perfect, not even in big games from big publishers (EA,Ubisoft,etc) (not even ARMA 2-3 make exceptions they have realistic physics but not pixel perfect collisions)

    in flash maybe you could do that easier? but in HTML5 and in C2 game performance is as good as the machine runs on! im back to that point!

    in end its pointless to search for pixel perfect collisions. you will see later on.

  • place bullet origin to right side of image ... then measure for its x position or distance from bullet position to the target bboxleft in your case it should detect the collision on the neck of 1 pixel.

    however, you have to keep in mind, that for each machine the game runs, different game behaviors and performances will happen, you cant expect on a old rig to get the best performance as on a top edge PC same applies to mobile, the users experience is as good as their hardware, you can only build the game for a recommended HARDWARE specification. no1 will expect the game to run perfect on a Macintosh for example the '84 released one!

    that means, even if you get the collision on ur pc on 1 pixel distance, others might not get it as you!

    what you need to do to avoid that! is used in multiplayer prediction system! where you take in calculation the PING user has/ in this case you have to take in consideration the machine cpuutilisation and FPS it runs at/ then predict when the collision wold happen, and make it happen 1/10 of a time faster.

    even so why wold you need pixel perfect collision on a game? you can fake the perfect collision with visuals, no player will notice it!

    the tutorial Asmodean suggested could fix your issue, but will raise others and complicate more things that i bet your game is based on solids and bullets. which you wont be able to deprecate the usage of the behaviors, just because of the pixel perfect issue!

    real question is: Is the 1 pixel collision really that important in the gameplay your building?!

    P.S personally never seen a 1 pixel collision system that works perfect, not even in big games from big publishers (EA,Ubisoft,etc) (not even ARMA 2-3 make exceptions they have realistic physics but not pixel perfect collisions)

    in flash maybe you could do that easier? but in HTML5 and in C2 game performance is as good as the machine runs on! im back to that point!

    in end its pointless to search for pixel perfect collisions. you will see later on.

    Thank you so much!

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