Change size and position of circle collision

0 favourites
  • 5 posts
From the Asset Store
You can change amount and speed of circles, length of lines and etc. Only 6 events.
  • Hi,

    I have a problem with a sprite and its collision zone.

    Here is the sprite in question:

    <img src="http://dl.dropbox.com/u/63083711/screenshots/collisionpb01.png" border="0" />

    Ideally, I'd like to use a circle as collision zone. But the collision seems to be larger than the character's body (as you can see on the picture above). Is it possible to set the circle zone size and position? (if would be... perfect)

    If not possible... There could be two solutions:

    • dividing the character into two parts (body and "legs") and apply the collision zone to the body, but I'd prefer to avoid that solution if possible (it creates different problems).
    • use a polygon as collision zone: it could be an alternative solution but in order to be efficient and get an accurate collision, I need to add many points. I know this is not recommended to put more than 8 points but I've tried with 23 points and the game doesn't seem more laggy than previously.

    Which solution(s) would you recommend?

    Thanks in advance!

    Rag'

  • Do you mean in the Physics behavior? I would recommend using a slightly smaller invisible object with the circle collision to get the size you want. Then, every tick set the position and angle of the player to the invisible object.

  • Yeah, the Physics behavior.

    That's an smart solution I've tried... but it doesn't work (more accurately: I can't make it work in my project... but yes, it would be great). I get crazy because of this... <img src="smileys/smiley5.gif" border="0" align="middle">

    Maybe if I describe what I want to do and what I need, someone would be able to help me. Here is the gameplay loop (unfortunaly it is an old version but you'll be able to figure out what it is about and in which context I need to have a physical objet "animated").

    http://dl.dropbox.com/u/63083711/index.html

    • The physical objets I mentioned are randomly generated from the bottom of the screen, every X frames.
    • First, I create the physical objet. I give it an ID (taken from a enemy count... I could use the IID but it doesn't work either, I suppose the problem doesn't come from there).
    • Then I spawn on it the visual aspect. I give it an ID, the same than the physical objet, in order to link both.
    • I can't link the two objets :o It's a mess: the very first spawned object and its visual aspect move as they should do, and once the second physical objet is spawned, all the visual aspects just... stop and don't follow the physical objects.

    Here is the code I use:

    <img src="http://dl.dropbox.com/u/63083711/screenshots/enemies01a.png" border="0">

    <img src="http://dl.dropbox.com/u/63083711/screenshots/enemies01b.png" border="0">

    <img src="http://dl.dropbox.com/u/63083711/screenshots/enemies02.png" border="0">

    That's the way I've done with the dropped balls (it's a physical objet with a visual aspect over it), but I don't know why... in this case, it worked :o

    Seriously, that's something that made me crazy for hours, maybe I've missed something obvious and stupid... but now, I don't know how to identity an objet among other similar, after having spawned them "generically". If I could master that kind of things, everything would be easier...

    Thanks in advance.

    Rag'

    PS: I may be unclear in my explanations and expectations... If so, please don't hesitate to ask questions in order to identify what's wrong. I really need to make it work <img src="smileys/smiley19.gif" border="0" align="middle">

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • (even if I'd really like to find a solution to the problem above, it would be great to set the circle collision, like it is possible with the box and polygon collisions... radius, center position etc.)

  • Ok, I think I'll create another topic relative to this specific problem, for more visibility...

    But in the case I wouldn't succeed to use properly the circle collision, would it be complete heresy to make a polygon collision with ~20 points?

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