Problem with collisions and bullet behavior

Get help using Construct 2

Post » Thu Oct 09, 2014 6:56 pm

Use the bullet behavior to give movement to the enemies. The issue is that sometimes I can not detect collisions and still long for offscreen.
It is not the first time it happens ...

How I can fix it?

https://db.tt/eNT2w6he
B
47
S
12
G
5
Posts: 124
Reputation: 6,851

Post » Thu Oct 09, 2014 8:33 pm

Your link doesn't do anything on my system. It just opens a black screen. Can you post a capx so to have a closer look?
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Thu Oct 09, 2014 11:17 pm

B
47
S
12
G
5
Posts: 124
Reputation: 6,851

Post » Fri Oct 10, 2014 12:28 am

@Wenaptic this isn't a problem of the bullet behavior, it is a result of the way you've set your system. The collision polygons of both your sprites are too small and after a while the sprites miss each other.
I' am sure that there is a better way to achieve the result you're after but I can't quite envision it. A quick fix using your setup would be to reset the Sprite's collision polygons back to full size and add a small delay before each angle of motion change. A wait action of 0.2 seconds looks ok for your bullet's current speed.
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Fri Oct 10, 2014 1:59 am

I had a quick tinker with the events and hope this makes sense. There was no need to have so many separate trigger events checking the sprite variable so I grouped them together under one trigger. It's also worth noting that there is a small overhead for redrawing the text object every tick (as I understand it) - you only need to command a change to the text whenever you change the text content (I've done that by using a function rather than duplicating the text-update event).

Edit to add that I increased the size of one of the collision boxes which is why the buggy collisions are fixed.
You do not have the required permissions to view the files attached to this post.
Last edited by Colludium on Fri Oct 10, 2014 9:31 am, edited 1 time in total.
A big fan of JavaScript.
B
76
S
20
G
74
Posts: 2,245
Reputation: 46,464

Post » Fri Oct 10, 2014 3:32 am

Wow! The code is more readable! I must work on my logic. Now I found no "bug". Thank you very much. :)
B
47
S
12
G
5
Posts: 124
Reputation: 6,851


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 49 guests