Thanks so much for sharing this its nice and clean. My project handles this a little different with a stunned state but its annoyingly complex sometimes. I never thought to use the animation curves so I will probably add that my my project too! Thanks again for the clear explanation
@sasquatchbgames
Жыл бұрын
You got it!! Glad you liked it. I've really been loving the animation curves lately lol and seem to find a good use for them in just about every tutorial.
@NeatGames
Жыл бұрын
Hey this is super useful! Currently I only have a "knock up" coded hehe. I hope I can get this working in my spaghetti code :D
@sasquatchbgames
Жыл бұрын
Hey man good to see you here! Thanks so much! Makes me happy to know you'd like to use it :D
@midniteoilsoftware
Жыл бұрын
Awesome video Brandon. Your presentation and pacing are perfect.
@sasquatchbgames
Жыл бұрын
That means a lot man, thank you so much
@midniteoilsoftware
Жыл бұрын
@@sasquatchbgames I call 'em like I see 'em
@pocket-logic1154
Жыл бұрын
Just wanted to say thank you for this video. I've learned a few things with this, and a couple of your other videos. I know the ins and outs of Unity pretty well, but it's always nice to review the basics, and even go back and listen to a few beginner tutorials for some fresh perspectives. You've earned a sub 👍
@sasquatchbgames
Жыл бұрын
So glad you liked it! Thanks 😊
@Notreal76
Жыл бұрын
This is a great Knockback function. I really like the implementation of the animation curve, gives a nice touch. :)
@Betruet
Жыл бұрын
I had to delete my comment because it was almost word for word the same as yours lmao.
@Notreal76
Жыл бұрын
@@Betruet 😂
@ryan_raus
29 күн бұрын
This is awesome! I’m struggling to make a system that scales knockback with accumulated damage, do you have any tips for this?
@manningfamilychronicles1601
Жыл бұрын
Great info. Out of curiosity, what is the purpose of naming things with _underscore. Is that just indicating that it's like... a sub variable to a method in the script?
@iiropeltonen
Жыл бұрын
It's a namin convention. It means the variable is private and a member of The class it is in.
@sasquatchbgames
Жыл бұрын
Just like liro said, it's a naming convention (I'm finally trying to get into the habit of it just now.) helps you know at a glance whether or not a private variable is a class variable or a method variable (assuming you name your method variables with no underscore.) Can save time in the long run (and help other devs read your code better if you have others working on your project with you.)
@midniteoilsoftware
Жыл бұрын
@@sasquatchbgames not only that, if your IDE supports auto-complete, typing _ will show all type-scoped members.
@pocket-logic1154
Жыл бұрын
While the other replies are great, it's also important to note that you don't have to name your variables this way. Some people do, some people do not. It does have certain benefits, as another user mentioned, however. It's also worth mentioning that if you do decide to use this naming convention, it's best to stick with it throughout your entire project.
@m0ck1ngb1rd4
4 ай бұрын
Hi, great video. I'm wondering if this works on both local and online multiplayer. We are making a game of knocking each other out of an 2d platform. Thanks
@alecraigan4568
4 ай бұрын
Hello! I have this small problem that the player gets launched to the right always even if the enemy came from the right, I don't know a lot about coding but the way I calculated the enemy's hitDirection was on the enemy script when they collided with the player I have this line playerHealth.hitDirection = transform.right.normalized; , do you know what I did wrong?
@xDTHECHEMISTx
Жыл бұрын
Hey Sasquatch this helped a bunch. i struggled to get this to work in other methods before i saw this video. But i wanted to ask, do you have any tutorials for 2D attacks where you can freeze movement for a frame of an attack? my character does this run and slash slide movement and i dont want that. I wanted that classic castlevania attack and pause style (stop movement) and then when the animation of attack is over it moves again. i was told animation events work for that but im just not getting anywhere with that how im doing it
@sasquatchbgames
Жыл бұрын
Interesting, animation events should do the trick as was suggested. They're one of the better methods to use cause it gives you precise control of when to hault movement and when to start it up again. I don't have a tutorial covering this. Are we simpply taking about haulting your player from walking? If so, you could handle it this way (I'll keep it simple for example) Let's say you have a bool CanMove. Ensure your player movement only runs if that bool is set to true. Default it to true. Add an animation event in your animation that sets it to false where you want, and back to true when you want. If we're talking about literally freezing "time" halfway through for just a moment, you could use an animation event to trigger a coRoutine that halts movement for a fraction of a second by changing the Time.Timescale to 0 (You'll need to use WaitForRealtimeSeconds to ensure the coRoutine runs independantly from the timescale.) Hope that helps!
@xDTHECHEMISTx
Жыл бұрын
@@sasquatchbgames Thanks for the insight on this. ill try this specifically. And yes the animation event for some reason at the time wasnt working at all for me for that particular stop movement situation. I do use the method for sounds and triggering game over screen at player dead sprite frames which works though
Пікірлер: 24