I recommend making an ECS (entity-component system) where every GameObject has a list of GameComponents and can be updated and drawn separately. Hell, you can make the SpriteRenderer one of them.
Wow, I had no idea you could set breakpoints in VS while the application was running. Hovering over the variables to see their values is such a nice feature that I'm gonna use the heck out of. Thanks for including that debugging exercise and not editing it out. :)
That's awesome to hear! I've tried to make a point to leave all of my mistakes and debugging sessions in the videos because that's part of being a programmer lol. Thanks for watching!
Whew! What a long video :D After going through the debugging, I had to back track because apparently I had another error that was causing my character to not show up. When setting up layerDepth I set it to 5f instead of .5f. woopsie :D great video. Thank you.
Thanks for checking them out! Yeah I am! I'm currently working on two new games, which is the main reason my TH-cam isn't super active. I'll probably always use FNA, because I think it's the best way to make 2D games!
Hey, Michael! After writing the code for keyboard readings on the player class, it doesn't work anymore for me. Do you have any idea why? The code is literally the same as yours and there's no error when I'm compilling the code, the character just doesn't react to the commands. Do you think it's something with the FNA latest releases?
I have one of the latest FNA versions and the input is working the same as it always has on my end! It could be some kind of deeper compatibility issue with your keyboard? I unfortunately have no idea. I'd set up a bare minimum project that tests input and if that doesn't work try asking in the FNA discord!
regarding @10:46 I would suggest altering how you handle required properties if (Image != null) { Origin = new Vector2(Image.Width / 2, Image.Height / 2); return; } throw new Exception(); to draw this object you will require the origin so there should never be a silent return on a requirement. At the very least set it to 0,0. I know you see tons of videos where folks do this but it isn't a good idea and could save you some debugging time... always fail loudly. If this logic should be moved to a full property is a religious debate but "gracefully handling exceptions" ie not handling exceptions is a crazy train of pain and suffering. That no one debates.
Hey thanks for the comment! That's a better route for a beginner video like this, but in my own games I prefer a silent treatment of this because a lot of times on large levels I'll only load the first section the player is in, then thread the rest of the image loading to speed things up. So that's why I don't use loud exceptions for variables related to the images. Of course, in a series like this I should have done it but I didn't think of it because I was taking code from my own engine. Thanks again!
I recommend making an ECS (entity-component system) where every GameObject has a list of GameComponents and can be updated and drawn separately. Hell, you can make the SpriteRenderer one of them.
Wow, I had no idea you could set breakpoints in VS while the application was running. Hovering over the variables to see their values is such a nice feature that I'm gonna use the heck out of. Thanks for including that debugging exercise and not editing it out. :)
That's awesome to hear! I've tried to make a point to leave all of my mistakes and debugging sessions in the videos because that's part of being a programmer lol. Thanks for watching!
Whew! What a long video :D After going through the debugging, I had to back track because apparently I had another error that was causing my character to not show up. When setting up layerDepth I set it to 5f instead of .5f. woopsie :D great video. Thank you.
Haha yeah that will do it, it only goes from 0 to 1 xD Glad you got it! Keep it up!
@@michaelartsmedia out of curiosity are you still working with FNA or making games? I checked out the two you have on steam. Nice work.
Thanks for checking them out! Yeah I am! I'm currently working on two new games, which is the main reason my TH-cam isn't super active. I'll probably always use FNA, because I think it's the best way to make 2D games!
@@michaelartsmedia good to hear. I'm looking forward to seeing what else you do. Are you on the FNA discord?
@@andrewmartin2341 I think so, but I'm not on Discord much haha
learning things each session!
That's great to hear =-D
Hey, Michael! After writing the code for keyboard readings on the player class, it doesn't work anymore for me. Do you have any idea why? The code is literally the same as yours and there's no error when I'm compilling the code, the character just doesn't react to the commands. Do you think it's something with the FNA latest releases?
I have one of the latest FNA versions and the input is working the same as it always has on my end! It could be some kind of deeper compatibility issue with your keyboard? I unfortunately have no idea. I'd set up a bare minimum project that tests input and if that doesn't work try asking in the FNA discord!
@@michaelartsmedia Okay, I'll to do that. Thanks for the answer!
regarding @10:46
I would suggest altering how you handle required properties
if (Image != null)
{
Origin = new Vector2(Image.Width / 2, Image.Height / 2);
return;
}
throw new Exception();
to draw this object you will require the origin so there should never be a silent return on a requirement. At the very least set it to 0,0. I know you see tons of videos where folks do this but it isn't a good idea and could save you some debugging time... always fail loudly.
If this logic should be moved to a full property is a religious debate but "gracefully handling exceptions" ie not handling exceptions is a crazy train of pain and suffering. That no one debates.
Hey thanks for the comment! That's a better route for a beginner video like this, but in my own games I prefer a silent treatment of this because a lot of times on large levels I'll only load the first section the player is in, then thread the rest of the image loading to speed things up. So that's why I don't use loud exceptions for variables related to the images. Of course, in a series like this I should have done it but I didn't think of it because I was taking code from my own engine. Thanks again!
you are amazing !