0 Favourites

Problem with collision[SOLVED]

This forum is currently in read-only mode.
  • 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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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

  • 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

  • Thank you guys!

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

    It's amazing how fast you get help here.

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