How do I Stop an Object at First Pixel Collision?

Get help using Construct 2

Post » Fri Dec 23, 2016 9:00 pm

While the bullet speed is 50 everything is ok

Image

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

Image

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

How can i do this?
B
29
S
14
G
1
Posts: 133
Reputation: 3,214

Post » Fri Dec 23, 2016 9:03 pm

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.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,991

Post » Fri Dec 23, 2016 9:05 pm

Ok,thank you :(
B
29
S
14
G
1
Posts: 133
Reputation: 3,214

Post » Fri Dec 23, 2016 9:17 pm

B
24
S
3
G
1
Posts: 454
Reputation: 2,171

Post » Fri Dec 23, 2016 9:34 pm

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.
B
78
S
23
G
69
Posts: 1,353
Reputation: 44,005

Post » Sat Dec 24, 2016 2:30 pm

gamecorpstudio wrote: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!
B
29
S
14
G
1
Posts: 133
Reputation: 3,214


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests