...set WIDTH to DISTANCE?

Get help using Construct 2

Post » Fri Nov 22, 2013 8:51 am

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)Cherico2013-11-22 08:52:00
B
22
S
6
G
2
Posts: 186
Reputation: 3,634

Post » Fri Nov 22, 2013 10:02 am

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)
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Fri Nov 22, 2013 10:24 am

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!
B
22
S
6
G
2
Posts: 186
Reputation: 3,634


Return to How do I....?

Who is online

Users browsing this forum: tetuan and 33 guests