These 5 Minute tutorials are amazing. Thank you for that. I hope it's not over yet because the last upload is over 8 month behind. Your on point every single time. Keep it up.
Wow bro... this is the first tutorial of my life that is clear, fast, efficient and even better than unity tutorial.... good job, pls continue to post video, we love it
for those who are having the issue where it only fires one direction, I figured out that it happens because of how you turn the player. if you follow the brackeys tutorials he has a guide for a 2d character controller but in a later video he changes how it is done for this exact reason. Most everything here still works but in the charactercontroller2D you need to change how you flip the player to "transform.Rotate(0f, 180f, 0f);" without the "quotes" and back in the projectile behavior script all you need is to change it to this " transform.position += transform.right * Time.deltaTime * Speed;" again without the "quotes" what is causing the problem is with scaling the sprite to change where you are facing the fix mentioned above is to make the sprite rotate rather than scale differently. because with scaling the lauchoffset stays looking to the right and will always think you are facing that direction and fire one way, but if you rotate the player parent object (change above) the lauchoffset will rotate with it, hope that helps
@@DistortedPixelStudios no I just found this video today and had the problem and then found a way to fix it. Most videos I've found dont have any sort of follow up with these problems so since I didnt see any comment about it I didnt even consider it
Hey don’t know if you still have that movement code but I don’t understand what I was supposed to do for the first fix also when I flip my character it goes invisible
First off this is an absolutely great video, and I'm keeping it for later, but in case there's anyone else who had the problem where the bullet spawned but didn't move forward at all the solution is in ProjectileBehavior replace the lines 6 to 10 with; public RigidBody2D _rigidBody //drag your the Projectile RigidBody2D into the _rigidBody box that'll be created under the script in the Projectile prefab inspector void Start() { _rigidBody.velocity = transform.right * Speed } I don't know why it didn't work for me and I don't see anyone else in the comments with this problem but... you can never be too sure, Cheers folks!
my issue was the bullet travels faster when the player is moving, but the bullet travels slower when the player is idle, however your solution was better for me anyways so thanks for that however you want to include Time.deltaTIme somewhere in there,
It fire but colision kill the bullet try 2:32 transform.position += transform.right instead of transform.position += -transform.right the minus makes bullet fly to character
If your bullet only moves in one direction, you're probably using localScale for flipping your player whereas in this video transform.rotate(0,180,0) is used for flipping. So, on your Flip method, just add at the end: LaunchOffset.transform.Rotate(0f, 180f, 0f); And when you instantiate your bullet, write : Instantiate(projectilePrefab, LaunchOffset.position, LaunchOffset.transform.rotation) All should work after that ;)
I have this problem, where: 1# I press the left mouse one, and three projectile spawn. 2# The projectile stay in the same spot, they won't fly any further. 3# The projectile only appears at one side, the right side and not the left side. How do I fix this? Also I'm using a different Player Movement Script, doesn't seem to raise any confliction though.
This worked for me however the bullet travels way faster when the player is moving and shooting at the same time and the bullet travels slower when the player shoots while standing idle. To fix that, I set the rigidbody2d body type of the projectile prefab to kinematic and now it fires much better from the players move speed but now it totally ignores my collisions detections. Update: Just realized there a checkbox for use kinematic/static collisions when you have kinematic body type selected, I think this body type works best for this tutorial
It's because the projectile collide with your player . I change "transform.position += -transform.right * Time.deltaTime * Speed;" to "transform.position += transform.right * Time.deltaTime * Speed;" and it worked. But the projectile is shoot in my back ... I think the code to set sprite rotation is a bit messed up but i didn't find solution
Hey i maybye need some Help ^^ so i did everything as it is shown in the video but this if (!Mathf.Approximately(0, movement)) transform.rotation = movement > 0 ? Quaternion.Euler(0, 180, 0) : Quaternion.indentity; wasnt there last video. When i put it in it says compile error if its out the projectile only shoots in one direction to the left and if i press d it doenst shoot to the right
i am getting this error: Assets\Player.cs(6,12): error CS0246: The type or namespace name 'ProjectileBehaviour' could not be found (are you missing a using directive or an assembly reference?
Okay so in the script, i there's no Projectile prefab and launchoffset option, i dont know why cause i follow the tutorial exactly the same. Any ideas?
OnCollisionEnter2D not working properly. When i was type "private void OnCollisionEnter2D" it looks like as a simple method. Does anyone know the solution?
For some reason whenever i shoot on the right i cant see it in the game and scene view but when i played it in 3d whenever i shoot to the right the projectile spawns behind the camera thats why i couldnt see it so i just moved the camera back so i can see it Why does it spawn behind the camera?
hey been following your tutorial step by step. but after i programmed the prefabs then ran the game. the console would recognise the button click but it doesn't show the circle bullet image. do you have any idea why this could be?? EDIT: i got it shooting, however the objects are not destroying, could anyone in the comments or yourself can bring this to attention please??
Thanks man this really helped me couse i am really into it and i'm working to a game and your tutorials really helped me. I really want to ask something. Can you please make a tutorial like how to pick up items like score u now how it is in Mario you pick up a coin and it gives you that coin if you can do that it will be really helpful for 2d btw couse from all the tutorials i watched yours were the most helpful and good couse you are going straight to the thing that you are showing in the video and usually almost no RUclips does that
Great tutorial! For some reason the projectile only moves right, regardless of which way the player is facing. Would love some pointers to this problem!
I wrote my script for the enemies projectiles and it worked flawlessly, but when I copy paste it to my player's the projectile just fly right through the enemy ?? The script for the enemies can kill my player but my player's script can't, even tho it's a copy paste from the enemies ?
Bro, I am making a 2d top down space shooter. There is a problem in shooting system, that is , when enemy is shooting and I shoot, then the player's bullet is colliding with enemy bullet and the player's bullet is destroyed but the enemies bullet is not destroyed. Can you tell me what to do to make the both bullets passing away without any collision.
Hi, nice tutorial! I have one problem, my character is only shooting to the right side. When i try to fire to the left, the projectile won't come out. Do you know what i did wrong?
Your Projectile collides with the player and gets destroyed. There are 2 ways of fixing that: Easy-Way: Move ur LaunchOffset Better-Way: in "OnCollisionEnter2D" add this: Character2DController charControl = collision.collider.GetComponent(); Character2DController player = charControl; if (!player) { Destroy(gameObject); ]
The quality of this tutorials it's amazing for your number of subscribers, keep workin on it men!
@@DistortedPixelStudios you could do a short tutorial series of a genre, like 5 videos for a simple game
These 5 Minute tutorials are amazing. Thank you for that. I hope it's not over yet because the last upload is over 8 month behind. Your on point every single time. Keep it up.
Wow bro... this is the first tutorial of my life that is clear, fast, efficient and even better than unity tutorial.... good job, pls continue to post video, we love it
old but gold, making a turret game and this got me started
for those who are having the issue where it only fires one direction, I figured out that it happens because of how you turn the player. if you follow the brackeys tutorials he has a guide for a 2d character controller but in a later video he changes how it is done for this exact reason. Most everything here still works but in the charactercontroller2D you need to change how you flip the player to "transform.Rotate(0f, 180f, 0f);" without the "quotes" and back in the projectile behavior script all you need is to change it to this " transform.position += transform.right * Time.deltaTime * Speed;" again without the "quotes" what is causing the problem is with scaling the sprite to change where you are facing the fix mentioned above is to make the sprite rotate rather than scale differently. because with scaling the lauchoffset stays looking to the right and will always think you are facing that direction and fire one way, but if you rotate the player parent object (change above) the lauchoffset will rotate with it, hope that helps
You do know that I show how to do this later in the video right?
@@DistortedPixelStudios no I just found this video today and had the problem and then found a way to fix it. Most videos I've found dont have any sort of follow up with these problems so since I didnt see any comment about it I didnt even consider it
@@DistortedPixelStudios at the end of the video? where?
Hey don’t know if you still have that movement code but I don’t understand what I was supposed to do for the first fix also when I flip my character it goes invisible
@@aroctagames4175 for now I’m gonna make my game with it only shooting right
i love how there is this relaxing music in a video about a really hard part of programming
its pretty simple actually
First off this is an absolutely great video, and I'm keeping it for later, but in case there's anyone else who had the problem where the bullet spawned but didn't move forward at all the solution is in ProjectileBehavior replace the lines 6 to 10 with;
public RigidBody2D _rigidBody //drag your the Projectile RigidBody2D into the _rigidBody box that'll be created under the script in the Projectile prefab inspector
void Start()
{
_rigidBody.velocity = transform.right * Speed
}
I don't know why it didn't work for me and I don't see anyone else in the comments with this problem but... you can never be too sure,
Cheers folks!
my issue was the bullet travels faster when the player is moving, but the bullet travels slower when the player is idle, however your solution was better for me anyways so thanks for that however you want to include Time.deltaTIme somewhere in there,
Hello guys, thanks for wonderful tutorial series. It's been very helpful ! Please, keep continue !!!!
"wow that huge" very sadistic
I have a strange issue here. When facing right, it shoots right but when facing left, the projectiles still go right and collide with the player
i posted a fix here its a lot to retype out but just look at that comment if you still need help
Not bad. Now lets get it following the mouse for directional firing!
It doesn't fire when the character turned to another side. (Every line of the code is written in a correct order)
It fire but colision kill the bullet
try 2:32 transform.position += transform.right instead of transform.position += -transform.right
the minus makes bullet fly to character
@@tigranvardanyan5530 instructions unclear, now every bullet hit me
@@Draunzler Try this
void Update()
{
transform.position += transform.right * Time.deltaTime * Speed;
Destroy(gameObject,3f);
}
So i have this problem. When i jump and shoot, the projectile doesn't collide with anything. Also they dont destroy on impact.
Have the same weird problem, it does work with the grenades, but with these it does not work
If your bullet only moves in one direction, you're probably using localScale for flipping your player whereas in this video transform.rotate(0,180,0) is used for flipping.
So, on your Flip method, just add at the end: LaunchOffset.transform.Rotate(0f, 180f, 0f);
And when you instantiate your bullet, write : Instantiate(projectilePrefab, LaunchOffset.position, LaunchOffset.transform.rotation)
All should work after that ;)
2:52 When I type the word, it does not offer me an article and does not accept my article, what could be the reason for this?
I have this problem, where:
1# I press the left mouse one, and three projectile spawn.
2# The projectile stay in the same spot, they won't fly any further.
3# The projectile only appears at one side, the right side and not the left side.
How do I fix this? Also I'm using a different Player Movement Script, doesn't seem to raise any confliction though.
This worked for me however the bullet travels way faster when the player is moving and shooting at the same time and the bullet travels slower when the player shoots while standing idle. To fix that, I set the rigidbody2d body type of the projectile prefab to kinematic and now it fires much better from the players move speed but now it totally ignores my collisions detections.
Update: Just realized there a checkbox for use kinematic/static collisions when you have kinematic body type selected, I think this body type works best for this tutorial
nice update and question did you run into the issue that OnCollisionEnter2D for the projectile is not firing off?
why my projectile can't get out and why my character if i cilck left mouse button doing backward
It's because the projectile collide with your player . I change "transform.position += -transform.right * Time.deltaTime * Speed;" to "transform.position += transform.right * Time.deltaTime * Speed;" and it worked. But the projectile is shoot in my back ... I think the code to set sprite rotation is a bit messed up but i didn't find solution
When I did the codeding the LaunchOffset and ProjecttitlePrefab is not by the others like Jump Force or Movement Speed
I'm getting an error where it says the namespace ProjectileBehaviour couldn't be found. I've made sure to spell it right and everything
Hey i maybye need some Help ^^ so i did everything as it is shown in the video but this if (!Mathf.Approximately(0, movement))
transform.rotation = movement > 0 ? Quaternion.Euler(0, 180, 0) : Quaternion.indentity; wasnt there last video. When i put it in it says compile error if its out the projectile only shoots in one direction to the left and if i press d it doenst shoot to the right
i have the same problem have you found any solutions?
@@appleduck1497 me to :c
the projectile only moves to the left, what is wrong?
i am getting this error: Assets\Player.cs(6,12): error CS0246: The type or namespace name 'ProjectileBehaviour' could not be found (are you missing a using directive or an assembly reference?
I have the same no idea how to fix it tho
@@dubbelthee8877 I changed it from ProjectileBehaviour to GameObject
@@16bitgamers17 thank you
easy to follow !! thanks alot
Okay so in the script, i there's no Projectile prefab and launchoffset option, i dont know why cause i follow the tutorial exactly the same. Any ideas?
See this timestamp 03:28
Really helpful tutorial, keep it up man! 👍
OnCollisionEnter2D not working properly. When i was type "private void OnCollisionEnter2D" it looks like as a simple method. Does anyone know the solution?
For some reason whenever i shoot on the right i cant see it in the game and scene view but when i played it in 3d whenever i shoot to the right the projectile spawns behind the camera thats why i couldnt see it so i just moved the camera back so i can see it Why does it spawn behind the camera?
Can anyone help when my projectiles hit the obstacles they don't destroy. There's no problem in my programming too
hey did you firgure it out???
Stuck as well
Im having trouble with manipulating the empty objects with my mouse, I dont know but it seems like Unity doesnt let me drag it
to what button is the fire button assigned? it gives an error that i havent did that yet
hey been following your tutorial step by step. but after i programmed the prefabs then ran the game. the console would recognise the button click but it doesn't show the circle bullet image. do you have any idea why this could be??
EDIT: i got it shooting, however the objects are not destroying, could anyone in the comments or yourself can bring this to attention please??
same here
Thanks man this really helped me couse i am really into it and i'm working to a game and your tutorials really helped me. I really want to ask something. Can you please make a tutorial like how to pick up items like score u now how it is in Mario you pick up a coin and it gives you that coin if you can do that it will be really helpful for 2d btw couse from all the tutorials i watched yours were the most helpful and good couse you are going straight to the thing that you are showing in the video and usually almost no RUclips does that
hey i used your code and my projectile donst vanish when it hits somthing and dosnt aim where im lookign, may i get help pls
Nice but how can i add range to it
Thanks for this amazing Tutorial
Can somebody paste me the ProjectileBehaviour Script im getting the same error over and over and its the simplist one i just dk how to debug it.
A huge thank you...😁😄💚💚💚💚
Thank you ! I tried more than 10 examples from Google. But only your code working.
Great tutorial! For some reason the projectile only moves right, regardless of which way the player is facing. Would love some pointers to this problem!
I wrote my script for the enemies projectiles and it worked flawlessly, but when I copy paste it to my player's the projectile just fly right through the enemy ??
The script for the enemies can kill my player but my player's script can't, even tho it's a copy paste from the enemies ?
One question, does the projectile really need a rigid body, since you are moving it with the transform?
Bro, I am making a 2d top down space shooter. There is a problem in shooting system, that is , when enemy is shooting and I shoot, then the player's bullet is colliding with enemy bullet and the player's bullet is destroyed but the enemies bullet is not destroyed. Can you tell me what to do to make the both bullets passing away without any collision.
thank you for the help but my projectiles are spawning on the back of the character and launches at him
do you still need help??
@@zakr2084 yes pls
@@Supribo so you see the game object called launch off set move it foward and if its still shooting towards you rotate z 180
@@zakr2084 ok im trying it RN
@@zakr2084 didnt work at all both of them
Hi, nice tutorial! I have one problem, my character is only shooting to the right side. When i try to fire to the left, the projectile won't come out. Do you know what i did wrong?
i dunno i have the same error
did you fin any solutions since?
The projectiles for me fire way back and don't fire at the correct line. Please help
thanks you
when i try to fire the characer just moves a bit and nothing happens
same
Your Projectile collides with the player and gets destroyed. There are 2 ways of fixing that:
Easy-Way: Move ur LaunchOffset
Better-Way: in "OnCollisionEnter2D" add this:
Character2DController charControl = collision.collider.GetComponent();
Character2DController player = charControl;
if (!player)
{
Destroy(gameObject);
]
For some reason my projectiles don't destroy whenever they hit other colliders, they just stop moving an stay there.
Что мне сделать, если влево пули летят нормально, а вправо они невидимые, но наносят урон. Все перепробовал уже
How can I make a delay so that you can’t constantly click to spam them
How can I get rid of the clones that go for ever?
thank you ...
on what do i shoot?
can you make a vid about how to shoot on cursor? (bad english srr)
my bolts keep going at a 45degree angle anyone know how to fix???!
it shoots only one way, to the left, but when i look right and fire, the bullets go in the same direction..
add a - to transform.right
@@RebrandSoon0000 How to?
hi my bullets go fro bricks what do i do
what button is suppose to be the fire button?
Left Mouse Button (but it depends on your settings in Unity > Edit > Project Settings > Input Manager)
the block doesnt clear the bullets for me??
does the block have a Collider2D on it? if not the "bullet" will just go through it
how about animated projectile
i dis the movement and jump tutorial but idk what button to press to jump
Ho my characters :V enjoy broz
for me it shoots at the right but it wont shoot at the left aswell
I figured out why if you still need help with this I posted what fixed it for me on my own comment (to much to retype)
Pliss make collectible item tutorial🙏🙏
"Type 'ProjectileBehaviour' already defines a member called 'Update' with the same parameter types."
No idea what that implies...
My projectiles dont get destroyed when they hit something qwq
Can you please put the script? It keeps giving me errors.
Which script? I can assist.
why it only works for 1 time?????? if i die in the game and start it again, non of your codes will work
I am this close to crying I did everything the same but it's not working at all >.
Same
Dust
This is a bad tuto