Problem with collision[SOLVED]

For questions about using Classic.

Post » Fri Jan 14, 2011 12:40 pm

Hi,


I have a strange problem with the collision detection. I use a simple bounding box detection. It works but not really good.

If the bullet shot from the players gun hits the enemy it should die after 5 or 10 hits, depending on the enemy. Unfortunately it rather die immediately or it detects no collision.

In "per pixel detection" the enemy dies after the right amount of hits, but in this collision mode it is very hard to hit something cause it is quite unaccurate.

I'am sure i missed again something important in my event code so if someone has a minute too look at my cap and show me my mistake, i would be glad.

Here is the cap:
http://www.mediafire.com/?v91b4k4rgn770wt

And the ini:
http://www.mediafire.com/?6r6iimmx5clvv18

You need the ini, cause i load the weopon information from this file. To pick up a weaopon just walk over one of the green or red sprite boxes. Moving with butten "w", aiming is done with the mouse and shooting with the left mouse button.
B
2
G
2
Posts: 15
Reputation: 680

Post » Fri Jan 14, 2011 8:01 pm

You put collision event under "for each...", so value 'hit' counts on amount of instances. Just put event out "for each". And it's better to use family ('bullet overlaps enemy"), so you can don't write events for each enemy type
Also, adding 'trigger once' condition or 'destroy bullet' action can prevent multiple triggering with one bullet.
And about accuracy: check out bullet hotspot , it's out of sprite
B
2
S
2
G
2
Posts: 158
Reputation: 1,366

Post » Fri Jan 14, 2011 8:24 pm

When you have For each... you are testing this loop's object, so where is For Each Rider, there should be On collision between Rider and Bullet - not Bullet and Rider. I've changed bullets speed to 500, it was to fast to check collision. If you want it back you'd have to make better collision check
LINK
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Sat Jan 15, 2011 4:02 pm

Thank you guys!

Thanks Noga for altering the cap. And setting the bullet angle to the mouse angle is a really good idea :D

It's amazing how fast you get help here.
B
2
G
2
Posts: 15
Reputation: 680


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests