How do I make a mining lazer

Get help using Construct 2

Post » Sat Jul 01, 2017 2:56 am

ok hi all here is what i want to do
when im in range of the asteroid
i want to click on it so then a lazer animation will make a line between the spaceship and the rock :) how can i make it ?
B
27
S
9
G
3
Posts: 136
Reputation: 3,750

Post » Sat Jul 01, 2017 3:31 pm

Hi,

You can do this perhaps with a Turret behavior (to keep auto aiming at the asteroid) and a bullet designed to look like a laser.

Make sure to destroy the bullet either on collision with the asteroid (where you can spawn sparks on collision) or on distance traveled to make sure that bullets don't go far.

You also want to have a very high rate of fire so that it looks like a laser visually. Such as SYSTEM every 0.05 seconds or whatever looks nice for you.
Thank you to Construct 2 for giving me the ability to create games without programming knowledge.

My games & gaming portal = DolyGames

If anyone wants to cooperate to help each other Win-Win please email me - I am always happy to discover new opportunities.

Cheers,

COSMOS
B
20
S
9
G
1
Posts: 75
Reputation: 2,152

Post » Sat Jul 01, 2017 9:19 pm

im not quite sure i can understand that can you explain more ?
B
27
S
9
G
3
Posts: 136
Reputation: 3,750

Post » Sun Jul 02, 2017 3:14 pm

http://www.blackhornettechnologies.com/Construct2Stuff/kiugetski_laser.capx
A common trick to drawing a line is to use a tiledbackground of a solid colour. You then just set the width to your distance, and angle appropriately.
ImageImageImage
B
71
S
21
G
230
Posts: 3,688
Reputation: 128,847

Post » Sun Jul 02, 2017 3:17 pm

the problem with this one is i cant have an animated laser

so i was thinking about
spawning the first anymation and set it size but if mouse is more then its size then spawn an otherone at the tip of the last one anmd so on
B
27
S
9
G
3
Posts: 136
Reputation: 3,750

Post » Sun Jul 02, 2017 3:28 pm

The most basic would be to spawn a rectangle "bullet" (has bullet behavior attached) of the color you want from an image point on your ship.
Make an event that checks if the mouse button is held down AND is over target AND within your specified distance then if all true spawn bullet at image point on the ship.
Upon creation set, the bullet's speed to something high like 3000, set its angle to Mouse.X, Mouse.Y.

Test this and you will see a visual "laser" streaking from your ship to the target (and past it). If there are gaps then make bullet rectangle longer.

You will now need to destroy the bullet "laser" pieces as they hit. This takes some adjusting since your bullets are longish.. you will need to put a Wait=0.01 or 0.02 to make it "look" right and maybe even tweak the values more so it looks like it is constantly striking target like a laser would.
Also on collision is not best option due to bullet speed, so use On-overlap wait=0.02 destroy bullet.

If you did everything right you will have a cool "poor man's laser".
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Mon Jul 03, 2017 9:13 am

alextro wrote:So you don't actually need secondary laser bouncing, just straight pointing laser with limited length to where it pointed.
Well laser doesn't behave that way but here you go:
https://www.dropbox.com/s/d855c8du24oin ... .capx?dl=0
ImageImage
B
105
S
46
G
23
Posts: 778
Reputation: 22,226


Return to How do I....?

Who is online

Users browsing this forum: darkrealos, luckyrawatlucky and 20 guests