Pinning objects to multiple creatures

0 favourites
  • 9 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • This should be an incredibly simple problem, but I just can't find the solution.

    I have multiple enemies, different instances of the same object, split between a head and a body so the head can be destroyed by headshots.

    I can't properly attach each instance's head to the body.

    My various attempts have either failed completely or just attached every head to the same body.

  • If you make the body and head part of a container then you can easily do what you want to do without pinning.

    select the body and click "create" in the container section of the properties on the left

    then click "add object" and pick the head.

    create the enemies by spawning the bodies, and the heads will automatically generate as well

    then use something like bullet on collision with head, destroy head.

    it will only destroy that particular head.

  • ...

    then use something like bullet on collision with head, destroy head.

    it will only destroy that particular head.

    Actually no. Destroying the head will destroy all elements in current container. Instead of destroy You can make it invisible or change animation.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There's a step missing in here. Not only is the head not following with the body, but it's automatically generating at the body's origin. Without the head following it, the same problem is still there.

  • I can't open it, you're running the beta release and I'm still on the stable one <img src="smileys/smiley36.gif" border="0" align="middle" />

  • <img src="http://dl.dropbox.com/u/34375299/Construct%202/examples/bodyheadcontainer.JPG" border="0" />

    Head and body are in container.

    In my example on start of layout I destroyed body sprite (head is automatically destroyed) to make sure there are no objects on layout.

    When you press left mouse button new object body is created (is in container with head so head sprite will be created as well) then i used the pin behavior on head to pin head sprite to body sprite.

  • Ah, see I have all the enemies pre-placed, not spawned. I assume then that I don't really need a container.

    I figured it out, though.

    I just used the Event System > For Each > Body, then the Action Pin Head to Body.

    I wish I knew exactly how it was able to determine which head to pin to the body, but none the less it works.

    Edit: It seems I do need the container. That seems to have been what was doing it; it preferred the head inside it's container when attempting to pin one on.

    Thank you for the help, both of you.

  • You do not need container for that - it's only an easy and quick way to do this.

    Other way, without using containers would be something like this.

    <img src="http://dl.dropbox.com/u/34375299/Construct%202/examples/bodyheadnocontainer.JPG" border="0" />

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