Bullet collision...The best way?

Get help using Construct 2

Post » Mon Aug 29, 2016 9:59 am

Hi all
I,m making a hokey game, and using the bullet behavior on the ball.
But sometimes when the ball hits the edges its go through it, the edges have the soiled behavior.

And the speed of the ball is just 1200, i think its not that much.
Also i used the line of sight method, but without any success.

Anyone have a solution or any other methods.

Thanks guys for any help
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Mon Aug 29, 2016 10:30 am

Did you try creating large invisible rectangles for the edges? Make them wide enough so that the ball will never be able to go through them.
B
30
S
6
G
1
Posts: 348
Reputation: 2,752

Post » Tue Aug 30, 2016 1:04 am

when something has the bullet behavior, it's not actually moving forward. it's more like teleporting forward however many pixels every tic (speed). so if it's moving 1200 pixels a second (isn't that the measure of the speed? pixels per second?), that's like 20 pixels per tic it's 'teleporting'. so if in a tic, your ball moves 20 pixels and that 20 pixels is enough to clear your edge boundary, then when the collision check happens, the ball is already on the other side of the edge.. so as @Rable said, you can use invisible edges to make sure your boundaries are big enough to keep that from happening.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Tue Aug 30, 2016 1:27 am

Post a capx and be sure to tag me with @tekniko.
B
56
S
15
G
13
Posts: 826
Reputation: 17,645

Post » Tue Aug 30, 2016 4:25 am

One way is to check for collisions between positions like one of these:
viewtopic.php?f=147&t=129016&p=908087&hilit=wall+collision#p908087
viewtopic.php?f=147&t=120838&p=864031&hilit=wall+collision#p864031
viewtopic.php?f=147&t=74257&p=619134&hilit=wall+collision#p619134

Another idea that i can't find an example for is to stretch a rectangle sprite from the old position to the new. Then if it collides you then can back the object up.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Tue Aug 30, 2016 1:12 pm

Thanks alot guys.
I will post an update after i try the new methods.

@Tekniko
The capx is very big, its a prototype for my new game.
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 59 guests