0 Favourites

Enemy spawn with hitbox?

  • I was thinking about creating random enemy spawns in the game (which is a platformer type game).

    However, I keep running into problems.

    Now, the enemy is fine if I manually place him. He is pinned to his hitbox at the start, and all is well.

    However, when I have the game spawn him at a spawn point, he is no longer pinned to his hitbox.

    I moved the enemy outside the layout and set him to destroy outside layout so he wouldn't interfere.

    I put the enemy and the hitbox in a container, and they both do spawn. They just aren't pinned. The enemy is stuck in place while the hitbox chases me around.

    I created the random enemy spawn by an event with system > create family (enemies) at a specific location.

    I don't know how to get the enemy pinned to the hitbox after he spawns. I already have code that was supposed to pin them (on start of layout, pin enemy to hitbox).

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Could you post your .capx? Maybe I could find a solution :)

  • Create hitbox (if the enemy is in a container the enemy will be created too)

    Enemy on created - pin to hitbox

  • Create hitbox (if the enemy is in a container the enemy will be created too)

    Enemy on created - pin to hitbox

    That's what I was looking for! Thanks.

    I had to also add an event to set the position of the enemy to the hitbox, and I had to adjust the origin point of the hitbox since it was off.

    It seems to work now. :)

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