Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Laser Enemy Script

Discussion in 'Scripting' started by noorcarvo00, Jul 27, 2015.

  1. noorcarvo00

    noorcarvo00

    Joined:
    Jul 7, 2015
    Posts:
    2
    Hello,

    I'm struggling to write a script for a laser in a 2d platformer. I just want it kill the player on impact. Please help.
     
  2. dworm

    dworm

    Joined:
    Jun 17, 2015
    Posts:
    74
    your question is too generic... what is the part you struggle with? drawing a line from point A to point B ? or you need specific AI or behaviour for the laser ?
     
  3. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667
    Chances are the laser and the "impact" are going to be two entirely different things. Or let me put it this way: the laser itself is a graphical effect, and the "impact" is a hit effect (most likely a raycast or the instantiating of a collider with an OnCollission effect of doing damage). You can split up the elements you're searching for to make the search easier, for instance scripts for guns (any guns) will have exactly the kind of hit effect you need, while graphical effects are a dime a dozen. Have fun!
     
  4. noorcarvo00

    noorcarvo00

    Joined:
    Jul 7, 2015
    Posts:
    2
    i am sort of a noob, do you know any good tutorials where i could learn that stuff
     
  5. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667