Search Unity

2D ranged shooting problems...

Discussion in '2D' started by noobman12345, May 12, 2019.

  1. noobman12345

    noobman12345

    Joined:
    May 12, 2019
    Posts:
    1
    hello guys, I just started my journey on game development like weeks ago and I been solving every problem I come up to. I made a new project where I have to shoot square sprite prefabs to triangle enemies that spawn randomly in the map.

    I was able to make the enemy system, player movement, health and score text and wanted to get started on the shooting part. I followed balckthornprod or whatever his name is’s tutorial and I get all of it. It works for him but it didn’t for me. The bullet shoots but it goes on a different direction. It’s supposed to shoot at the mouse direction. The bullet also changes direction when I move the mouse. I don’t have my computer right now but I’ll show it later.

    I also have a video but it says it’s too large, sorry I just found out about unity forums..
     
  2. justLC

    justLC

    Joined:
    Oct 16, 2018
    Posts:
    45
    I think we might need to take a look at your shooting script and especially the bullet script.

    So it seems, you are calling the direction of the bullet in an update function. If the bullet should have a constant velocity, you only need to set it one time. Which exactly do you mean by "different direction"? Does it travel in the opposite direction?