How do I create a collision area around a sprite?

0 favourites
  • 8 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • First of all I'm sorry for my poor English.

    Well, in the image above you can see, the player sprite (green), the Enemy I sprite (yellow) and the Enemy II sprite (red). Both have a smaller and a larger circle, the smaller one is the character (player/enemy), and the largest circle is the character collision area. What do I need? I need that when any character come into any other character collision area, they attack themselves.

    I do not know if that changes anything, but there may be more than 1000 characters ...

    And I have no idea how to do this ...

    I hope you understand my problem, thank you.

  • Seeing that if u have more than 1000 chars ur .capx file would probz contain alot. But Have it check If the middle Player is Overlapping the collision Sprite, and then attack if its overlapping. Are u using a Pin function For the Middle Sprite on the Collision?

  • There are two ways you can use. First, is to use a container to add a different sprite to your character sprite and have it act as the collision detection. The second, and more simpler, is to create a larger collision area for your characters. While setting up your collision points in the editor, you can actually set it outside your sprite height and width. So create a circle shaped collision and place it outside so that it is big enough to fill the area you need.

  • You can create an invisible sprite called collision check and set it's position to the character every thick, and use this sprite in your events to create the logic. Also, you can use line of sight behavior. If character B > has line of sight to > any character A > attack. You can use families to separate them by types of characters, like enemies, friendly character, etc.

  • Compare Distance (Player.X, Player.Y, Enemies.X, Enemies.Y) < xPixel = Destroy?

    (put Enemies into a Family)

    Line of Sight would also work (better?!)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can create an invisible sprite called collision check and set it's position to the character every thick, and use this sprite in your events to create the logic.

    My question is: If i have more than 1000 sprites, how can i assign the collision check to each sprite? I don't know how to make the collision check and the sprite work as if they were one. If I had only one character would be easy to do, but if I have 1000 for example?

    The player and the AI will can create an arm, things can't be static...

  • ..., is to use a container to add a different sprite to your character sprite and have it act as the collision detection.

    Nice, I had not thought of in the containers, I will do some tests to see how they work..

  • > You can create an invisible sprite called collision check and set it's position to the character every thick, and use this sprite in your events to create the logic.

    >

    My question is: If i have more than 1000 sprites, how can i assign the collision check to each sprite? I don't know how to make the collision check and the sprite work as if they were one. If I had only one character would be easy to do, but if I have 1000 for example?

    The player and the AI will can create an arm, things can't be static...

    Just use line of sight behavior for the collision checks. With only this, you can create hundreds of instances of the same object and still the collision checks and actions will dealt according to each instance that have matched your condition.

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