How do I make a mining lazer

  • 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 ?

  • 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.

  • im not quite sure i can understand that can you explain more ?

  • 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.

  • 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

  • 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".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

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