...set WIDTH to DISTANCE?

0 favourites
  • 3 posts
From the Asset Store
The collection includes pre-categorized selections that can be the definitive tone setting backdrop to gameplay.
  • Hello and sorry about my english ;)

    I want to make an space-shooter-game, where the player controls a ship and build weapons (turret-controlled) with power-ups (like in battlespace commander - a really great game!!!).

    The turret-behavior is absolutly great to control the weapons and it works fine when i "shot" a bullet in direction of an enemy.

    BUT...!

    I also want to have a laser as weapon - and the width of the laser should be the same as the distance between the weapon (turret) and enemy (not a fixed-width-laser-sprite that shoots into the enemy like a bullet).

    I hope you understand what i mean?

    The problem is, that the width of the laser is always the distance between turret and enemy ONE (the first created one).

    I created an test-capx to show you my problem:

    CAPX or LIVE DEMO

    (Arrow-keys to control)

    The command for shooting:

    Turrend: on shoot - Turrent spawn Laser, set width or Laser to distance (Turrent.X, Turrent.Y, Enemy.X, Enemy.Y)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want the laser to hit the nearest enemy, use

    Enemy - Pick nearest

    or if you want an enemy with a special propery use pick by comparison or for each ordered (together with a stop loop command directly at first execution)

  • I already tried "pick nearest", but when i use "turret: pick nearest enemyX,Y" it does not work. Now i try "enemy: pick nearest turret" - it works! Thanks!

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