Collision detection techniques

This forum is currently in read-only mode.
From the Asset Store
Detects any kind of ad blocker. Very easy implementation into already existing projects
  • As someone new to Construct, I'm curious as to what more experienced developers think would be the best method for handling collision detection in a game with multiple weapon and monster types.

    The most obvious method is to make an event to test between the player sprite and each monster sprite/monster weapon sprite, and then more events to deal with every player weapon sprite and every monster sprite. That's a LOT of events, especially as you add more and more weapons/attacks/monsters/monster attacks.

    An alternative method I'm considering is to have just one "Monster" sprite, with different animations for different monster types, and just one "Hero Weapon" sprite with different animations, and one "Monster Weapon" sprite. What do you think?

  • Families would be the best way to do it, if you don't want to make them all 1 sprite.

    http://apps.sourceforge.net/mediawiki/c ... e=Families

    When used correctly, they should eliminate the repetitive code you are worried about

  • You can also use families to generalise all your different kinds of bullet and projectiles, using private variables to set how much damage they cause, what kind of explosions/effects they create, etc.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay, when using a family like this, say I have an enemy with an attack-on-touch value. I can use an event to detect a collision between the player and any enemy. Now how do I access the private attack value of the enemy I just collided with?

  • Hmm, good question. I would think you would want to do this:

    <img src="http://willhostforfood.com/users/stainsor/screen.png">

    with "Enemy.Value('damage")" instead of "0" in the first action.

    Actually I guess you'd want it instead of "global('damage')" in the final action.

    But you can't choose Enemy, you can only choose individual sprites.

  • Families show the private variables which all the objects in the family have in common. You can use the Family Manager to quickly add a variable to all the objects in the family.

  • Hmm, good question. I would think you would want to do this:

    <img src="http://willhostforfood.com/users/stainsor/screen.png">

    with "Enemy.Value('damage")" instead of "0" in the first action.

    Actually I guess you'd want it instead of "global('damage')" in the final action.

    But you can't choose Enemy, you can only choose individual sprites.

    You mean like this?

    <img src="http://i44.tinypic.com/21de8ea.png">

    And just to clarify, you can enter the family name into the expression editor (in other words, manually type in "Enemy.Value('damage')" )

  • You mean like this?

    <img src="http://i44.tinypic.com/21de8ea.png">

    And just to clarify, you can enter the family name into the expression editor (in other words, manually type in "Enemy.Value('damage')" )

    Exactly like that.

    And I wondered if that would work. That's good to know.

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