Attack Spesific Instance of Enemies

0 favourites
  • 2 posts
From the Asset Store
Zombie attack is a survival game, where you have 2 types of games: Killer and survival.
  • Hello

    I'm currently creating a game that looks like RPG game. I have an issue to attack specific instance of enemies with a bullet which the bullet always aim the clicked or targeted enemy. In this case I use Set Angle Toward Position in Every Tick Event. There the issue appears. Every X second an enemy will spawn. But, when I click specific object the bullet will aim random enemy. How do I can match the bullet target with clicked enemy? That action is possible in the same event (Click Event), but in another event (That is Every Tick event) the targeted enemy cannot be determined.

    I try like this:

    On Left Button Click on Enemy -------> Spawn Projectile

    Every Tick -------> Projectile Set angle toward (Enemy.X, Enemy.Y)

    I heard this can be solved by matching UID. But I don't know. Can you help me?

    Best regards

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Add a variable called 'TargetUID' to the bullet.

    On Left button on Enemy: Spawn projectile. Set Bullet.TargetUID to Enemy.UID

    Set the angle toward Enemy( Bullet.TargetUID ).X, Enemy( Bullet.TargetUID ).Y

    That's it

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