HINT: If your bullets move too fast, sometimes collision can't be detected. Select your bullet prefab and in Rigidbody settings, set Collision Detection to "Continuous"
im having some trouble with anything from the pack even coming up, i might just be stupid but it would be great if you could help me with that!. anyway i love all of your videos (:
1:07 whene i come back to the unity it say "Method must have a return type"" I did evry thing that you did and try every thing. plz help I am in a geme jam and i need to fix it fast
Don’t use it, the new input system is better in every way. You can check my input course about the new input system and how to correctly use it (with rebinding)
Create a timer. For example: float timer = 0; float shootDelay = 0.2f; void Update() { if (Keyboard.current.spaceKey.wasPressedThisFrame && Time.time>=timer) { Instantiate(bulletPrefab, shootingPoint.position, transform.rotation); timer = Time.time + shootDelay; } } You can create other types of timers, this is just one example.
How can i make it so instead of flipping the character around it flips the Shooting Point and makes it fires in the other direction, when i flip my controls get mixed up
hello is there a way you can just teach me the enemy and killing the enemy tutorial and if you already have one can you please tell me which one? because when I try get the enemy and damage it just gives me errors
Seems like you also need to learn the basics of C#. Try my course on Udemy/Skillshare. You will learn C# from scratch and there is also a section about enemies.
Depending on what input system you are using, old or new. If you want to learn more about the new input system and C# in general, try my course on Udemy/Skillshare.
Hi, I copied your code for the bullet but it comes up with lots of errors :(. I was wondering if it's maybe, because I'm using the 2022.3.11 version of unity?
This is the code that I have for bullet and it keeps coming back with 10 errors :( Some of them say things like "The modifier 'private' is not valid for this item" or "Type or namespace definition, or end-of-file expected". I'm pretty sure I followed the tutorial and copied everything correctly. using System.Collections; using System.Collections.Generic; using UnityEngine; public class Bullet : MonoBehaviour { public float speed; private Rigidbody2D rb; void Start() { rb = GetComponent(); rb.velocity = transform.right * speed; } } private void OnTrigger2D(Collider2D collision) { Enemy enemy != null) { enemy.TakeDamage(20); } Destroy(gameObject); } }@@RootGames
Yes, you need to have a variable that will store the direction of the player, for example: 1 when he is facing right, -1 when he is facing left, then when you instantiate your bullet prefabs, pass that variable to them and multiply the speed with it, the bullets should fly to the right and left depending on the direction variable.
Spawn the bullet and then pause the game. Inspect your spawned bullet. It has to have the Bullet script and Rigidbody2D component. Also check that the speed variable is not 0.
The double jump is covered in my Udemy course. I can give you an idea of how to make enemies shoot but there are so many types of enemies. The principle is the same, instantiate the bullet prefab from the enemy shooting point. You can do it with a timer or when the player enters a certain area, then start shooting. Thanks for subscribing :)
Hey Nanda, sorry but the discord server is exclusive and available only for people who enrolled in my courses. You can find them on Udemy or Skillshare 🙂
@@nandakishorsd6731 Don't be sad. Black Friday is coming and courses will be at really affordable prices, even now there are coupons in the description🙂
HINT: If your bullets move too fast, sometimes collision can't be detected. Select your bullet prefab and in Rigidbody settings, set Collision Detection to "Continuous"
good bro help me a lot
My bullets are moving too slow
To give so much knowledge to create a playable game in a shade over 4 minutes is just unbelievable. Sir, you just won yourself a follower 🤩
Same over here
This tutorial was amazing. Thank you a lot
is it possible to implement score that updates with firebase?
Thank u for the great insight
im having some trouble with anything from the pack even coming up, i might just be stupid but it would be great if you could help me with that!. anyway i love all of your videos (:
1:07 whene i come back to the unity it say "Method must have a return type"" I did evry thing that you did and try every thing. plz help I am in a geme jam and i need to fix it fast
How did you created enemy prefab and spawner? I'm Confused :(
have u got it ?
What about using the legacy input system?
Don’t use it, the new input system is better in every way. You can check my input course about the new input system and how to correctly use it (with rebinding)
What's in the 1st to 10th lines of enemy.cs ?
Thank you very much bro subbed immediately
Thanks! 😀
great tutorial, definitely deserves a sub
Much appreciated!
Really cool one 👍
Thanks 😉
can I make it so that I can switch the shooting point without pressing the down button
What would be a good way to add a delay between shots?
Create a timer. For example:
float timer = 0;
float shootDelay = 0.2f;
void Update()
{
if (Keyboard.current.spaceKey.wasPressedThisFrame && Time.time>=timer)
{
Instantiate(bulletPrefab, shootingPoint.position, transform.rotation);
timer = Time.time + shootDelay;
}
}
You can create other types of timers, this is just one example.
@@RootGames Got it. Works great! Thank you.
Thanks!
Thanks for help
But how to make it the longer you press the shooting button the more dammage you deal
i need a full screbt in document file plz :)
How can i make it so instead of flipping the character around it flips the Shooting Point and makes it fires in the other direction, when i flip my controls get mixed up
Is this the same game you taught in the course?
No, if you click on the Udemy link, you can watch a preview of the course.
hello is there a way you can just teach me the enemy and killing the enemy tutorial and if you already have one can you please tell me which one? because when I try get the enemy and damage it just gives me errors
Seems like you also need to learn the basics of C#. Try my course on Udemy/Skillshare. You will learn C# from scratch and there is also a section about enemies.
At 0:45, how would I make it instead shoot when clicking the mouse?
Depending on what input system you are using, old or new. If you want to learn more about the new input system and C# in general, try my course on Udemy/Skillshare.
When I rotate, the shooting point doesn't move with my player, how do I fix this? (I also connected it to the player script
It needs to be a child object of the player.
How would you make this continuously fire when holding down the shoot keybind.
You need a timer and use Keyboard.current.spaceKey.isPressed
thanks
Hi, I copied your code for the bullet but it comes up with lots of errors :(. I was wondering if it's maybe, because I'm using the 2022.3.11 version of unity?
No, it’s not.
This is the code that I have for bullet and it keeps coming back with 10 errors :(
Some of them say things like "The modifier 'private' is not valid for this item" or "Type or namespace definition, or end-of-file expected". I'm pretty sure I followed the tutorial and copied everything correctly.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bullet : MonoBehaviour
{
public float speed;
private Rigidbody2D rb;
void Start()
{
rb = GetComponent();
rb.velocity = transform.right * speed;
}
}
private void OnTrigger2D(Collider2D collision)
{
Enemy enemy != null)
{
enemy.TakeDamage(20);
}
Destroy(gameObject);
}
}@@RootGames
goated tutorial
What about the Spawner script?
Can you make a clone of the bullet removed when it passes through the camera?
To destroy bullets when they go off the screen use OnBecameInvisible and Destroy functions.
is there a way i can shoot in the direction with scaling the player to -1 and 1
Yes, you need to have a variable that will store the direction of the player, for example: 1 when he is facing right, -1 when he is facing left, then when you instantiate your bullet prefabs, pass that variable to them and multiply the speed with it, the bullets should fly to the right and left depending on the direction variable.
@@RootGames how to can store the veriable for direction of the player if the bullet is in a different script?
@@munroy529 When you instantiate the bullet, use getcomponent for the script in which you store directions. Then pass it to the bullet in the "Start"
can u explain the practical system that u made in the video ?@@RootGames
my projectile is not moving and i don't know why
I had the same problem ???
I can spawn the Bullet in but not get it to move
Spawn the bullet and then pause the game. Inspect your spawned bullet. It has to have the Bullet script and Rigidbody2D component. Also check that the speed variable is not 0.
does not work says redParticles does not work in Enemyscript
My bullets jus fly in to one direction😂
How to enemy get a damage?
i cretead a bullet but it doesnt flip side, its always shooting to the right side
Maybe you are flipping the player using scale and not rotation.
Hi, Shooting Point (and bullets) doesn't flip with my player. How do I correct that?
Shooting point needs to be a child object of the player. Then use rotation as mentioned in the video and it must work.
Problem is I'm using a different player sprite and script to yours and the rotation code will mess up my sprite
Also the bullets only fire right.
root games would you make about double jump or enemy that shoots bullet pls
The double jump is covered in my Udemy course.
I can give you an idea of how to make enemies shoot but there are so many types of enemies. The principle is the same, instantiate the bullet prefab from the enemy shooting point. You can do it with a timer or when the player enters a certain area, then start shooting.
Thanks for subscribing :)
can u tell more detail about spawner
use instantiate along with a empty game object to declare where to spawn your prefab
It sadly breaks my entire character i start rotating infinitly
can i see your movement script?
Where is the redPartical File. What is written there.
Red Particle is a particle system prefab.
My bullets fell straight to the ground
Make sure you set gravity to 0.
Using the new Input system fucks with my other scripts
You can do the same thing with the old system, but consider shifting to the new. The old one is ditched by Unity, the future is the new system.
I love you i think
Im so bad at developing that even this does not work for me
Don't give up! 😉
its hard to follow you can u slow down a bit
pause the video
3:33
better write [SerializeField] private
Upload The Code.
Sorry, I don't have it anymore, but you can see everything in the tutorial. The only thing you need to create is your Particle System prefab.
real
is there no way for us to just copy your code i have to write all of this such a pain
3:20 , please give me the full script , like i need it rn , please
Thank you
No problem 😉
plzz your discord server
Hey Nanda, sorry but the discord server is exclusive and available only for people who enrolled in my courses. You can find them on Udemy or Skillshare 🙂
@@RootGames thats really sad :(
@@nandakishorsd6731 Don't be sad. Black Friday is coming and courses will be at really affordable prices, even now there are coupons in the description🙂
@@RootGames oh ok then I will be waiting for that! really really waiting for your course to get in my hand XD