if your Player is moving faster diagonally, write: rb.MovePosition(rb.position + movement.normalized * moveSpeed * Time.fixedDeltaTime); in Fixed Update :)
Thanks to you, my life took a direction. I had no idea which profession to choose, totally unmotivated with my college. I want to graduate, but I don't see myself working in the area (Electrical engineering). After watching your videos, I found myself in game development and that's what I've been doing as a hobby for some time. I've never been so happy and ambitious. Thank you so much for teaching us for free.
Same, I got an associate's in computer programming because I wanted to be a developer. At the time I thought an associates in programming is more practical than a bachelors in computer since I only really need to learn how to code. Learned how to code in static languages java, c#, c++, and c which made learning other languages easier. Most of the time I just read other people's code and is enough to understand what's going on without the need for explanation.
Well, it's been 4 years now, and I couldn't be better! Drop out of my degree and got deep into game development and programming. Managed to make a living out of it, paid for a huge wedding and a big house. All of it in 4 years, and this was the kick-off. There are places in the world where people don't have the freedom to chase their dreams. If life is giving you the opportunity to chase yours, go for it! Everything is gonna be alright
I run into the problem, that when i use the Animator with the Blend tree, that when i try to run right, it shows me the animation of running left - is this common with the mirror solution or did i mess smth up?
@@TheStelzi The solution is giving is only half true. By clicking it in inspector you don't change it according player input. What you can do however is to reference the sprite renderer in your script and use a condition to set spriteRenderer.flipX to true only when movement.x is negative. I think this should work: SpriteRenderer spriteRenderer; void Start() { spriteRenderer = Getcomponent(); } void Update() { //Existing code from the video spriteRenderer.flipX = movement.x < 0.01 ? true : false; } Just complete the code with it and it should work :)
Out of all the videos i've watched for top down animation, this is the simplest and most easiest to understand. Seriosly, it was apain releiver, thank you so much.
I have to confess. I have watched hundreds of Brackeys videos. SO, I kept the video to play and tried to do it myself before this video finishes. And I DID!! Thank you so much for all this help. Yes you stopped UA-cam, never means you don't exist. THANK YOU for everything!
I recommend flipping the animations with code, this way you only have to write a few lines of code, and all animations (Walking, Attacking, Jumping etc) will face to the correct side without flipping all the images, its just faster and simpler
when I type `public Rigidbody2D`, visual studio doesn't seem to pick up Rigidbody2D as anything. I've created a Rigidbody2D in unity and it looks exactly like the one Brackeys made so I don't know what the issue is. I don't know if you'd be able to help since you only did it four months ago?
Something I ran into: My player character kept on slowly moving down when no controls where pressed. Reason: In my project settings was gravity defined in de section Physics2D Fix: Go to Edit > Project Setting > Physics2D and change the value of Gravity from -9,81 to 0, Note that you only want to do this if you want to make a top down 2D game :)
This was 22 minutes well spent, I learned here what I struggled to find elsewhere. If you watch just one video that explains movement, make it this one.
I'm only 9 minutes in, and I've already managed to make the kind of movement type I was looking for! I was so sure that it was going to be more difficult then it was, I guess I have been using an outdated method because this was much simpler! I wanted the player to be able to move slowly too, (using an xbox controller for input) and all I had to change was it to GetAxis from GetAxisRaw! THANK YOU SO MUCH BRACKEYS!!!
I wasn't able to make it work so I got so triggered but after 5+ hr of debugging, I found out that my movement preferences were messed up. I was so mad and I almost quit. NEVER GIVE UP GUYS!!!
That wouldn't work for many different scenarios, if you're making a game where you need to flip the entire player game object instead of just the sprite then the camera will also flip
Thank you so much for this guide, this is my first time using unity and c# programing and this guide made it easy to do, even with small inconviences with the newer software. keep making these as it helps more than you think, great work
FULL PLAYER MOVEMENT SCRIPT for anybody who wants it :D using System.Collections; using System.Collections.Generic; using UnityEngine; public class playermovement : MonoBehaviour { public float speed = 5f; public Rigidbody2D rb; Vector2 movement; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { movement.x = Input.GetAxisRaw("Horizontal"); movement.y = Input.GetAxisRaw("Vertical"); } void FixedUpdate() { rb.MovePosition(rb.position + movement * speed * Time.fixedDeltaTime); } }
FULL SCRIPT LAST ADDITION using System.Collections; using System.Collections.Generic; using UnityEngine; public class playermovement : MonoBehaviour { public float speed = 5f; public Rigidbody2D rb; public Animator animator; Vector2 movement; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { movement.x = Input.GetAxisRaw("Horizontal"); movement.y = Input.GetAxisRaw("Vertical"); animator.SetFloat("Horizontal", movement.x); animator.SetFloat("Vertical", movement.y); animator.SetFloat("Speed", movement.sqrMagnitude); } void FixedUpdate() { rb.MovePosition(rb.position + movement * speed * Time.fixedDeltaTime); } }
Am super new to unity and coding and am wondering if you could help me at all? - At 4 minutes he writes a 'public float', when I try to do this in unity 'public' blues out, but nothing comes up when I add 'float' (stays white). Any pointers of what I'm missing/ or done wrong would be hugely appreciated! probably a stupid question but im slow lol
@@nwoooyz Thanks man! I managed to fix that part i think by installing a Studio package that I had missed - but had a similar issue 2 lines down with another 'variable' or something. Im now getting stuck into studio/c# tutorials because I think i might need to start there before working on player movement lol, appreciate the offer though
Breaking down games will be another thing that would give insights and will motivate beginner and experienced developers/artists. Would love to see that.
Thanks for the video! Though would you please cover the player facing too? As in determining which direction the player would attack / interact on. Without it the player movement isn't really complete.
You are a legend man you arent aware how much you help me learn to make games I've had an issue for so long and you helped me fix it thank you bless u man.
You can set that in the animation window. You can set idle as the default animation state. So from entry a transition to idle animation state then a transition from any state to the idle animation.
@@nautics9927 I don't know if this is the best way but I created another state on the animator called 'idle' (the same way the 'movement' state). Also created 4 animations with the idle sprite each. On the idle state it's basically the same as movement state but changed the animations to the idle ones Deleted the transition from movement->player_idle and added new transitions from movement->idle and idle->movement with the condition of speed accordingly Changed the code to the one on the comment section void Update() { movement.x = Input.GetAxisRaw("Horizontal"); movement.y = Input.GetAxisRaw("Vertical"); if (movement != Vector2.zero) { animator.SetFloat("Horizontal", movement.x); animator.SetFloat("Vertical", movement.y); } animator.SetFloat("Speed", movement.sqrMagnitude); }
one quick thing, from what ive seen sometimes the x axis controls are backwards, just add a - before input.getaxisraw("horizontal"). i spent hours trying to find what issue that was (since im pretty new to all this) and then i went t the official unity discord server, and they said to add a - before that bit, it solved everything. just saying this so the rest of you guys won't end up wasting hours
Thanks for the video Brackeys. I have a couple decently successful games which used your methods as a starting point and then expanded upon them. Your tutorials are legit.
In movies (I've heard), night footage is often shot during the day and is post-processed by overlaying a blue filter. Maybe this works in Unity, too -- by using a plane on top of the game world and animating the color of that plane...?
I'm new to all of this and I think this video was truly awesome. I don't know anything about coding and I'm not sure that I would be able to learn it but I'm encouraged. Thanks for sharing.
For those who are wondering how you can stop the player from looking down every time he stands still, use an if statement, like this. if (movement != Vector2.zero) { animator.SetFloat("Horizontal", movement.x); animator.SetFloat("Vertical", movement.y); }
fuck this easily took me two hours to sort through every bug that came up throughout this but it was so worth it to see my custom animation work thank you brackeys
@@isaacgejames Thought so, too, at first, but having watched one or two videos on this channel where we get shown impossible amounts of stuff (in each video), I can easily see Brackeys show us as much as @WINTERFALL STUDIOS asked for. ;)
@@isaacgejames Well, I guess, the original post was meant as a suggestion should Brackeys ever run out of content ideas. And let's add "enemy slicing routine" to the mix while we're at it ;)
I've not finished watching the video yet, but I got up to 8:55 and then added some really simple if functions to Update() **see the code below** it just catches if x or y movement are anything other than standing still limit the other. Should help you void Update() { // Input movement.x = Input.GetAxisRaw("Horizontal"); // left give -1 and right give us +1 movement.y = Input.GetAxisRaw("Vertical"); // up give -1 and down give us +1 if(movement.x != 0) { movement.y = 0; } if (movement.y != 0) { movement.x = 0; } }
for people having problems with stuff this may help, put this in the Start() function of your movement script rb = GetComponent(); animator = GetComponent();
Add me to the "yes please!" queue for breakdown videos. And if you're taking suggestions on topics, I'd love to see how you'd implement the npc movement calendar script employed in games like stardew valley.
There’s already a wonderful channel called “Mix and Jam” that kind of does game mechanics breakdown or cloning. But the more the merrier! Also you might make it simpler and more easier to see!
These timestamps are mostly for me for my interactive project (WARNING: THIS IS NOT AN OFFICIAL TIME STAMP, IT'S ONLY FOR ME TO HELP ME OUT WITH MY PROJECT): 1:18 adding Idle animation into project 3:07 Two step rule 3:23 going through first step Player must have rigidbody2d component Player must have zero gravity scale to make sure they do not fall Must enable freeze rotation z to make sure they do not rotate randomly 3:44 adding c script
you should set the transition time to 0.3 so if the player smashes the keyboard or you something follow the player the animation doesnt get constantly switched
I’d love for you to talk about how cities skylines works! Soooo much going on in that game. Traffic AI, weather, zooming in and out to different levels of detail smoothly etc...
I think the movement is pretty easy to get down with games like these once you understand the basics of Unity. What I do still struggle with though is how to do the collision boxes. Pasting a ton of colliders over one another just seems messy and rickety to me, but I haven't found any way to make a nice and solid area that the player is allowed to be in yet... Also, when not using a rigidbody2d and creating your own movement, I still haven't found a good way to script collisions. Could you maybe make a video that goes more in-depth on making collisions/borders for your world?
Can you do a tutorial of how to flip the character by script? I don’t have photoshop and even if I did, really don’t feel like importing it, flipping it, and then reimporting it into Unity. (Or just add it to a small video, because it’s probably to small for a full video.)
in the controlelr script you do in a method that gets called when u get the input : if(Input.GetAxisRaw("Horizontal") < 0) { GetComponent().flipX = true; } else if(Input.GetAxisRaw("Horizontal") > 0) { GetComponent().flipX = false; } that should work, if not , try flipY instead of flipX
@@philippsommer7820 Thanks! I was wondering the same thing as Cryob, i managed to flip the image in another program bu the image was muddy, this helped a-lot!
Loved this video! Just got one question! How would I do an idle animation for each direction (north, south, east west), and leave the sprite in that idle animation based on the last direction blend tree animation that was used?
Movement is one of those things that I get stuck on all the time. I have an idea what I want to make, but 2 hours later I realize I'm still making a movement controller.
Just use unity teams and have everyone join the project. Make sure not to work on the same assets at the same time, and always give appropriate names to your changes so you can track what's added.
@@deetvleet Yeah but for the free collaborate version in unity, you can only have 3 people in your team, and the team sizes can be a max of 5 for this game jam so we wouldn't be able to use unity collaborate would we?
Yep, I'd be keen for a game breakdown. Anything to make us more aware of of the subtleties that make a game better or more appealing, which we could consider or apply to our own ventures. One using Ratchet and Clank wouldn't go amiss either :)
if your Player is moving faster diagonally, write:
rb.MovePosition(rb.position + movement.normalized * moveSpeed * Time.fixedDeltaTime);
in Fixed Update :)
Thanks! That was a weird thing I didn't notice till you pointed it out.
If anyone gets stuck on this, it has to be in American, not standard English, normalised does not work.
@@Nuan07 he says normalized
ty for this tip
How can i remove diagonal movement ?
Timestamps for quick reference on animations.
8:55 Animations
12:41 The Animator
14:20 Blend Tree
thanks!
1:50 start
thank you
That breakdown idea could be AMAZING! Please make it!
no replies wth?
2 replies
3 replies
4 replies
5 replies
Thanks to you, my life took a direction. I had no idea which profession to choose, totally unmotivated with my college. I want to graduate, but I don't see myself working in the area (Electrical engineering). After watching your videos, I found myself in game development and that's what I've been doing as a hobby for some time. I've never been so happy and ambitious. Thank you so much for teaching us for free.
Same, I got an associate's in computer programming because I wanted to be a developer. At the time I thought an associates in programming is more practical than a bachelors in computer since I only really need to learn how to code. Learned how to code in static languages java, c#, c++, and c which made learning other languages easier. Most of the time I just read other people's code and is enough to understand what's going on without the need for explanation.
That’s heart warming. !!!
Well, it's been 4 years now, and I couldn't be better! Drop out of my degree and got deep into game development and programming. Managed to make a living out of it, paid for a huge wedding and a big house. All of it in 4 years, and this was the kick-off.
There are places in the world where people don't have the freedom to chase their dreams. If life is giving you the opportunity to chase yours, go for it! Everything is gonna be alright
@@leogcavalli Thats fantastic :D hope you continue to do so well
I WOULD LOVE TO SEE GAMES BEING BROKEN DOWN, EXPLAINED, AND COMPARED!
Awesome
Extra me too!
Would be awesome!
+30
WHY ARE YOU YELLING?
A simple way to flip the animation (For walking left):
In animation window, click add property -> sprite renderer -> flip x
I run into the problem, that when i use the Animator with the Blend tree, that when i try to run right, it shows me the animation of running left - is this common with the mirror solution or did i mess smth up?
@@TheStelzi The solution is giving is only half true. By clicking it in inspector you don't change it according player input. What you can do however is to reference the sprite renderer in your script and use a condition to set spriteRenderer.flipX to true only when movement.x is negative. I think this should work:
SpriteRenderer spriteRenderer;
void Start()
{
spriteRenderer = Getcomponent();
}
void Update()
{
//Existing code from the video
spriteRenderer.flipX = movement.x < 0.01 ? true : false;
}
Just complete the code with it and it should work :)
@@ImInfenix Thanks for your answer! I will try this approach as well :)
While this does work, it will only flip the sprite not the collider.
Thank you
Out of all the videos i've watched for top down animation, this is the simplest and most easiest to understand. Seriosly, it was apain releiver, thank you so much.
I have to confess. I have watched hundreds of Brackeys videos. SO, I kept the video to play and tried to do it myself before this video finishes. And I DID!! Thank you so much for all this help. Yes you stopped UA-cam, never means you don't exist. THANK YOU for everything!
Sad thing he already stopped UA-cam :(
he came back, but does GoDot now.
I recommend flipping the animations with code, this way you only have to write a few lines of code, and all animations (Walking, Attacking, Jumping etc) will face to the correct side without flipping all the images, its just faster and simpler
how can I do this please
@@frameberryy 21:05
6:48 brackeys is metagaming he knows he'll make a video to cover topics that aren't a thing yet
@@DolphLOL jeez you need to chill
@@wilkieroyall3507 did someone delete a reply?
@@TheDemopan3 it would appear so
Yet again you post a video at the perfect time I needed one.
same
same
Love this, tutorial thank you for creating it! I recreated it in 2022 and the input system still works the same way. :)
thanks for this update, I was looking to see what changed
when I type `public Rigidbody2D`, visual studio doesn't seem to pick up Rigidbody2D as anything. I've created a Rigidbody2D in unity and it looks exactly like the one Brackeys made so I don't know what the issue is. I don't know if you'd be able to help since you only did it four months ago?
Something I ran into: My player character kept on slowly moving down when no controls where pressed.
Reason: In my project settings was gravity defined in de section Physics2D
Fix: Go to Edit > Project Setting > Physics2D and change the value of Gravity from -9,81 to 0, Note that you only want to do this if you want to make a top down 2D game :)
Or you can change the RigidBody type to Kinematic instead of dynamic
thank you so much! (:
He was trying to get away and escape
You can set Rigidbody2D Gravity Scale to zero
omg thank you so much
This was 22 minutes well spent, I learned here what I struggled to find elsewhere.
If you watch just one video that explains movement, make it this one.
I'm only 9 minutes in, and I've already managed to make the kind of movement type I was looking for! I was so sure that it was going to be more difficult then it was, I guess I have been using an outdated method because this was much simpler! I wanted the player to be able to move slowly too, (using an xbox controller for input) and all I had to change was it to GetAxis from GetAxisRaw! THANK YOU SO MUCH BRACKEYS!!!
I wasn't able to make it work so I got so triggered but after 5+ hr of debugging, I found out that my movement preferences were messed up. I was so mad and I almost quit. NEVER GIVE UP GUYS!!!
This channel inspires me to follow my dream to become a game developer. Thank you for your hard work!
Yes, how is it going??
If someone wanted to they could make an actual Professional Looking Game from this channel's Tutorials
@@NotOxity that's hard
Of course we would like to hear about how a specific feature of a game is made! Please do it Brackeys!
I watched so many videos and spent so much time but this was the only video that actually helped me. Thank you very much
This was great! First time using blend trees and spritesheet animations in Unity, and I got it the first time with this lesson.
its a good day when you find a brackeys tutorial on what you need
if you want the camera to follow the player, just put it inside of the player. (in the hierarchy)
That wouldn't work for many different scenarios, if you're making a game where you need to flip the entire player game object instead of just the sprite then the camera will also flip
Thank you so much for this guide, this is my first time using unity and c# programing and this guide made it easy to do, even with small inconviences with the newer software. keep making these as it helps more than you think, great work
Definitely would like some breakdown videos.
This was SO, SO HELPFUL! As someone with literally no coding knowledge, I thank you very much for making this so easy!
Ive done a video about Forager like movement a while ago.
This video is a nice addition and as always I love your video!
Good work brackeys!
I'm ur subscriber!
Doing this for every character and enemy is gonna be so much work, dayum!
FULL PLAYER MOVEMENT SCRIPT for anybody who wants it :D
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playermovement : MonoBehaviour
{
public float speed = 5f;
public Rigidbody2D rb;
Vector2 movement;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
}
void FixedUpdate()
{
rb.MovePosition(rb.position + movement * speed * Time.fixedDeltaTime);
}
}
FULL SCRIPT LAST ADDITION
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playermovement : MonoBehaviour
{
public float speed = 5f;
public Rigidbody2D rb;
public Animator animator;
Vector2 movement;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
animator.SetFloat("Horizontal", movement.x);
animator.SetFloat("Vertical", movement.y);
animator.SetFloat("Speed", movement.sqrMagnitude);
}
void FixedUpdate()
{
rb.MovePosition(rb.position + movement * speed * Time.fixedDeltaTime);
}
}
Am super new to unity and coding and am wondering if you could help me at all? - At 4 minutes he writes a 'public float', when I try to do this in unity 'public' blues out, but nothing comes up when I add 'float' (stays white). Any pointers of what I'm missing/ or done wrong would be hugely appreciated! probably a stupid question but im slow lol
@@ethanethan9575 I'm not very good with code either but I know a thing or 2 so could you reply with your script? I MAY be able to help.
@@nwoooyz Thanks man! I managed to fix that part i think by installing a Studio package that I had missed - but had a similar issue 2 lines down with another 'variable' or something. Im now getting stuck into studio/c# tutorials because I think i might need to start there before working on player movement lol, appreciate the offer though
@@ethanethan9575 ofc anytime
Breaking down games will be another thing that would give insights and will motivate beginner and experienced developers/artists. Would love to see that.
Starts at 1:48
Ive been searchig this for a long time, watching different vídeos and then you come and find a easier way. How the hell you do it? I admire youuu!!!
Thanks for the video! Though would you please cover the player facing too? As in determining which direction the player would attack / interact on. Without it the player movement isn't really complete.
You are a legend man you arent aware how much you help me learn to make games I've had an issue for so long and you helped me fix it thank you bless u man.
Awesome tutorial!) Also, I suggest to normalize movement vector, or your character will move faster diagonally.
Thank you! Blend trees are really useful in these cases) but I also made idle state a blend tree, too, which consists of idles for each side)
Simple question, how would you update the player idle pose depending on the last direction they were moving in?
You can set that in the animation window. You can set idle as the default animation state. So from entry a transition to idle animation state then a transition from any state to the idle animation.
@@arnmazing3156 can you explain more, i made the transitions but for some reason it did not work?
@@nautics9927 I don't know if this is the best way but I created another state on the animator called 'idle' (the same way the 'movement' state).
Also created 4 animations with the idle sprite each. On the idle state it's basically the same as movement state but changed the animations to the idle ones
Deleted the transition from movement->player_idle and added new transitions from movement->idle and idle->movement with the condition of speed accordingly
Changed the code to the one on the comment section
void Update()
{
movement.x = Input.GetAxisRaw("Horizontal");
movement.y = Input.GetAxisRaw("Vertical");
if (movement != Vector2.zero)
{
animator.SetFloat("Horizontal", movement.x);
animator.SetFloat("Vertical", movement.y);
}
animator.SetFloat("Speed", movement.sqrMagnitude);
}
@@ayamajirou thanks! I'll try this rn
@@ayamajirou Alright it worked!!! thank you!!!
Halfway through 2020 and this is still an awesome tutorial
You can also make a blend tree of idle state. So that it will face according to the movement.
How?
@@BreadAckerman How?
+1 for breakdown videos. It would be awesome to see analysis of what makes certain games tick.
you could put *.normalized* after *movement* when you use it so that the player cannot go faster diagonally!
@Bzone ?¿
one quick thing, from what ive seen sometimes the x axis controls are backwards, just add a - before input.getaxisraw("horizontal"). i spent hours trying to find what issue that was (since im pretty new to all this) and then i went t the official unity discord server, and they said to add a - before that bit, it solved everything. just saying this so the rest of you guys won't end up wasting hours
Brackeys recomending a video that at that time didn't existed 🤯🤯🤯
Thanks for the video Brackeys. I have a couple decently successful games which used your methods as a starting point and then expanded upon them. Your tutorials are legit.
Thanks for the video. Can you do a top down day-night cycle? Thank you very much Brackeys
In movies (I've heard), night footage is often shot during the day and is post-processed by overlaying a blue filter. Maybe this works in Unity, too -- by using a plane on top of the game world and animating the color of that plane...?
I'm new to all of this and I think this video was truly awesome.
I don't know anything about coding and I'm not sure that I would be able to learn it but I'm encouraged. Thanks for sharing.
For those who are wondering how you can stop the player from looking down every time he stands still, use an if statement, like this.
if (movement != Vector2.zero)
{
animator.SetFloat("Horizontal", movement.x);
animator.SetFloat("Vertical", movement.y);
}
Thanks for this, only a few days in to learning c#/unity, but this is simple enough to understand and I was wondering why it wasn't in the video.
Thanks
I don't quite understand where to put it in the code.
@@kingastro1508 Thank you so much. Finally making progress with my game, now!
@@kingastro1508 it's not the worst. I've started learning how to use tile pallets, rigid bodies and colliders in the meantime.
I own my own studio. Thank you for all of your advice on Unity, this will not be the last time you get thanks from me!
that breakdown thing is a good idea!
Excellent - I was trying to code this using individual transforms but this is much more elegant
Breakdown stuff would be amaaaazing
fuck this easily took me two hours to sort through every bug that came up throughout this but it was so worth it to see my custom animation work thank you brackeys
A tutorial series about third person melee combat with movement, parrying and some other stuff
a bit much but would be cool I gues
yeah that's the type of stuff you learn yourself
@@isaacgejames Thought so, too, at first, but having watched one or two videos on this channel where we get shown impossible amounts of stuff (in each video), I can easily see Brackeys show us as much as @WINTERFALL STUDIOS asked for. ;)
@@isaacgejames Well, I guess, the original post was meant as a suggestion should Brackeys ever run out of content ideas.
And let's add "enemy slicing routine" to the mix while we're at it ;)
Needed help, found Brackeys, followed the easy recipe. Job done. Now feeling very proud of myself. Thanks you SO MUCH!
I'm going to enjoy this video... Although I just solved the problem myself yesterday...
Then you found out Brackeys did it better and you felt stupid
This is the best Unity tutorial ive ever seen
Awesome tutorial! If only there was a code to stop diagonal movement! If somebody could help with that I would be forever thankful.
I've not finished watching the video yet, but I got up to 8:55 and then added some really simple if functions to Update() **see the code below** it just catches if x or y movement are anything other than standing still limit the other. Should help you
void Update()
{
// Input
movement.x = Input.GetAxisRaw("Horizontal"); // left give -1 and right give us +1
movement.y = Input.GetAxisRaw("Vertical"); // up give -1 and down give us +1
if(movement.x != 0)
{
movement.y = 0;
}
if (movement.y != 0)
{
movement.x = 0;
}
}
Rewatching Brackeys's old videos:)
@Brackeys Can you make a tutorial about Procedural Level Generation?
church out black thrown prod he has a few good vids on that
This tutorial still works on 09/28/20! Thanks so much for this! Works great!
i went to the comments to see if it still worked THANK YOU
Can we get a top down RPG tutorial?
bruh
@@icedchqi Thanks for replying to a 1 yo comment
@@rpgtogether7022 i dont discriminate by age of comment, I always be annoying no matter what
@@icedchqi "Discriminate" is definitely the right word there buddy. Also the later part makes 0 sense
@@rpgtogether7022 Discriminate is actualy
the right word for the context.....look up the meaning
bro..finally i joined the jam..i am excited..though i am new to game development.but a special thanks to u.Your videos helped me a lot..
Thank you for the help.
Great explained and everything!
If i should rate it i would give it a 5/5
for people having problems with stuff this may help, put this in the Start() function of your movement script
rb = GetComponent();
animator = GetComponent();
Yeah, a better way to reference self components, rather than manually adding it with a public variable.
Would love to see projectiles, bosses, ect. like you did for normal 2d but for top down
The gamedev breakdown is a really good idea! Please make it a series! :D
Add me to the "yes please!" queue for breakdown videos. And if you're taking suggestions on topics, I'd love to see how you'd implement the npc movement calendar script employed in games like stardew valley.
Me looking at every other video and you are the only person that can teach me.
There’s already a wonderful channel called “Mix and Jam” that kind of does game mechanics breakdown or cloning. But the more the merrier! Also you might make it simpler and more easier to see!
Game Breakdowns? Definitly something great, go for it! There are some already on level design, but a focus on visuals would be great as well!
I tried using Unity.
I am psychologically scarred and will never be the same ever again.
if you want to make something in unity try something simple like a sprite that walks around
Yay! Awesome tutorial! The best top down animation lesson on the web! ❤️🤓👍
Funny that I literally programmed movement one hour before you uploaded this video.
For me it was thr opposite. That he uploads the video before I wantes to programm topdow movement
This helped so much, thanks! R.I.P Brackeys
why rip
@@haddo8054 He stopped making videos
@@smartishgd ah thats bad
These timestamps are mostly for me for my interactive project (WARNING: THIS IS NOT AN OFFICIAL TIME STAMP, IT'S ONLY FOR ME TO HELP ME OUT WITH MY PROJECT):
1:18 adding Idle animation into project
3:07 Two step rule
3:23 going through first step
Player must have rigidbody2d component
Player must have zero gravity scale to make sure they do not fall
Must enable freeze rotation z to make sure they do not rotate randomly
3:44 adding c script
you should set the transition time to 0.3 so if the player smashes the keyboard or you something follow the player the animation doesnt get constantly switched
A tutorial on tile interactive system like how you can target tiles on the ground in Stardew valley please
Check out his tower defence to see how to interact with ground
Loveee the breakdown idea!! Especially if it breaks down how you think they did certain features
me : does exactly what brackey says
unity : ERROR CS1061
Ha ha ha. Classic comedy.
Me too brother! I've done the same what Brackeys did but ERROR! I don't know what can I do now.
This is too relateable
There’s something called google
me: searches ERROR CS1061 in ecosia.
This tutorial was absolute perfection, thank you!
I’d love for you to talk about how cities skylines works! Soooo much going on in that game. Traffic AI, weather, zooming in and out to different levels of detail smoothly etc...
Superb tutorial as always! Really love the idea for breaking down game pipelines. Please do that
I think the movement is pretty easy to get down with games like these once you understand the basics of Unity. What I do still struggle with though is how to do the collision boxes. Pasting a ton of colliders over one another just seems messy and rickety to me, but I haven't found any way to make a nice and solid area that the player is allowed to be in yet... Also, when not using a rigidbody2d and creating your own movement, I still haven't found a good way to script collisions. Could you maybe make a video that goes more in-depth on making collisions/borders for your world?
how can anybody dislike this vid
it is just impressive
Can you do a tutorial of how to flip the character by script?
I don’t have photoshop and even if I did, really don’t feel like importing it, flipping
it, and then reimporting it into Unity.
(Or just add it to a small video, because it’s probably to small for a full video.)
in the controlelr script you do in a method that gets called when u get the input :
if(Input.GetAxisRaw("Horizontal") < 0)
{
GetComponent().flipX = true;
}
else if(Input.GetAxisRaw("Horizontal") > 0)
{
GetComponent().flipX = false;
}
that should work, if not , try flipY instead of flipX
Thanks Philipp
@@philippsommer7820 Thanks! I was wondering the same thing as Cryob, i managed to flip the image in another program bu the image was muddy, this helped a-lot!
@@philippsommer7820 Thanks!
THANK YOU. Finally a movement tutorial with comprehensive techniques I can actually use haha
Loved this video! Just got one question! How would I do an idle animation for each direction (north, south, east west), and leave the sprite in that idle animation based on the last direction blend tree animation that was used?
I also was hoping for an answer on this
This is super cool! I am glad it's straight forward; yet very powerful!
Thank you!
Movement is one of those things that I get stuck on all the time. I have an idea what I want to make, but 2 hours later I realize I'm still making a movement controller.
@@harshitchoudhary2821 same :((
@@harshitchoudhary2821 Ohh, it's alright 🙏🏻
@@harshitchoudhary2821 until now, very confuse :''
Yes yes, we really want games breakdown videos
I would like a game in which player face in direction of its last movement direction
if (movement != Vector2.zero) {
animator.SetFloat("Horizontal", movement.x);
animator.SetFloat("Vertical", movement.y);
}
@@allenlopez7507 It dosen't work for me :(
@@Racinne did you find solution for that ? cause im suffering for a week
Breakdown of some indie games hits made in Unity would be so perfect!
note: the input system is still working in 2021 so dont stop programming
thx
I repeated after him but my code doesn't work
This video is amazing. Thank you!
2:03
Firstly, nice video
Secondly, can you do a video on how to collab with your team for the upcoming game jam via github or unity or whatever
Just use unity teams and have everyone join the project. Make sure not to work on the same assets at the same time, and always give appropriate names to your changes so you can track what's added.
@@deetvleet Yeah but for the free collaborate version in unity, you can only have 3 people in your team, and the team sizes can be a max of 5 for this game jam so we wouldn't be able to use unity collaborate would we?
@@oliverscott6913 Well, that's what happens when you don't pay (Also i know I'm late)
watching this in the middle of the game jam
16 views, 15 likes.
Good community.
4k views 481 likes.
.
3276 views, 6 dislikes.
3270 views.
Don't mess.
@@CaseyHofland 89.353
98,815 views, 4.7k likes
Yep, I'd be keen for a game breakdown. Anything to make us more aware of of the subtleties that make a game better or more appealing, which we could consider or apply to our own ventures. One using Ratchet and Clank wouldn't go amiss either :)
9:00 in is when animation starts and scripting ends.
brackeys yet again, saves the day