How do I using multiple copies of the same instance without bugs?

0 favourites
  • 7 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hello everyone, I need a little help with my code, I'm trying to make a platform adventure game and I'm having a hard time making enemies.

    If I use the "For Each" function for the blue bear instead of each being fixed to each lilac cube that represents his hitbox, the two stick to the same cube.

    How can I arrange it? Could you give me suggestions?

  • Easiest solution would be to put the hitbox and the sprite in a container. scirra.com/manual/150/containers

  • You can use the container suggestion earlier, but I also don't understand why you wouldn't use the Pin Behavior instead of updating the X,Y every tick? Add the pin behavior to your "fanatico" and then on creation of your hitbox have it create and pin the fanatico to itself.

  • Easiest solution would be to put the hitbox and the sprite in a container. scirra.com/manual/150/containers

    As I understand it, the containers are useful so that the event that affects an object automatically affects another associated object through the container.

    The problem is that I intend to use the lilac cube for verification and hitbox and the blue bear will display the animations as an enemy.

    How can I make each cube and the bear be together with the pin behavior for example, without them being fixed as a single object?

    Why if I want to put more than one enemy copy, I would have to re-create all of his events so that the other copy can act independently.

  • You can use the container suggestion earlier, but I also don't understand why you wouldn't use the Pin Behavior instead of updating the X,Y every tick? Add the pin behavior to your "fanatico" and then on creation of your hitbox have it create and pin the fanatico to itself.

    I tried to use each one separately.

    Correct me if I'm wrong, but the 'every tick' uses more memory than 'pin behavior' right?

    If so, it may be best to use 'pin behavior'

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need to identify (Pick) specific instances of objects.

    If for instance you wish to pick the pinned cat of a hitbox, you can do so with cat.pin.pinnedUID which returns the UID of the object pinned. Using this with the "Pick by comparison" condition will let you identify specific objects and all subsequent sub events will occur only to that pinned instance of the objects.

  • The problem is that I intend to use the lilac cube for verification and hitbox and the blue bear will display the animations as an enemy.

    I dont know why this is a problem. Here is an example capx for containers:

    1drv.ms/u/s!Ap_-qxoGKbDchBN7kFSidbkX8bL3

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