This is the last video of this year! And it's the longest video I've ever made on this channel! I sacrificed my sleep just so I could publish it before 2022. So please, if you enjoyed the video, hit the like button and subscribe for more content like this! Also, consider supporting this channel on Patreon for exclusive content as well as early access to future videos and projects: www.patreon.com/Kofybrek P.S. I just realized that I forgot to add destructible obstacles above the player. Ugh! I hate myself!
Fun fact: in the original game the enemies weren't planned to move faster as you killed them, but because there was less calculation to do with less enemies, the computer started calculating their movement faster. But it worked really well, so it was left in as a feature.
Have you heard of enums? its a useful feature, for example you can use an enum for the enemy type instead of unsigned char. It makes the code more readable
TH-cam recommended this to me! This channel really is a hidden gem!! I'm currently learning sfml and c++ myself. One question: for how long have you been programming or learning c++ and sfml? I'm wondering because I'm learning it myself. Thanks! And subscribed! :)
i think its better to always just check the first element in the vector of bullets to see if its out of bounds, and if so then remove it. this way you dont have to check the entire vector each time
4:30 Instead of asking yourself whether or not youre committing an unforgiable sin, I would call that return by value function an unforgivable sin. Always return by reference if possible.
@@Kofybrek You basically avoid unnecessary copying. In C++ you can either return by value or by reference. If you want to return by reference, you use the & symbol as you showed in the video. Otherwise your function will always return by value. The difference between return by value and return by reference is that return by value returns a copy of your actual data and return by reference returns the actual data itself without any additional copying. Let's say you have these functions: std::string GetName() { return m_Name; } std::string& GetName() { return m_Name; } Both functions simply return the m_Name variable, however the first function returns by value and the second one returns by reference. The first one will actually allocate additional memory to make a copy of the m_Name string and then return this copy. The second function will return the actual m_Name variable, hence allowing you to modify (or not if you don't need to) that data without any extra memory allocations. Imagine you have a vector with 1000 of elements. If you want to modify the actual vector outside of the class that owns it, you HAVE TO return by reference, because modifying a copy doesn't change the original data, obviously. But even if you just want to read the data, you should return by reference to avoid unnecessary copying/memory allocations. The reason for that is that these unnecessary memory allocations will have an impact on your performance. Obviously the code in this video would not suffer from return by value functions, because your program is very small. However, it is good coding practice to remember to return by reference if possible. I hope I made this a bit more clear now to you :D
I think it'd be better if you went into more detail about the less commonly known things, like how you drew animations or why you used std::clamp (I've never seen anyone else use it). But I'm dumb so maybe not
You forgot the barriers that protect the player and injure the aliens, in the ps1 game you could move them up when you hit them and after a bunch of hits they blow up
I have always been interested with coding but never done anything because I cba to code But I am very good with coding logic gates in scrap mechanic. One thing I have made was the no internet game with TERRIBLE graphics because I cba lol
This is the last video of this year! And it's the longest video I've ever made on this channel! I sacrificed my sleep just so I could publish it before 2022. So please, if you enjoyed the video, hit the like button and subscribe for more content like this!
Also, consider supporting this channel on Patreon for exclusive content as well as early access to future videos and projects: www.patreon.com/Kofybrek
P.S. I just realized that I forgot to add destructible obstacles above the player. Ugh! I hate myself!
Unfortunately I can't donate but I'm indeed subscribed!
ладно, с новым годом! удачи тебе)
----
okay happy new year! good luck to you)
"We can fix this problem by deleting the project" is what I think at 3AM when my messy code has made everything horrible to work on and fix
Fun fact: in the original game the enemies weren't planned to move faster as you killed them, but because there was less calculation to do with less enemies, the computer started calculating their movement faster. But it worked really well, so it was left in as a feature.
Interesting!
Érdekes.
wow... clever!
Great video! Dont stop making videos. The quality is sooo good and they are so much fun to watch. You derserve a lot more subscribers!
This guy inspired me to get started with game development
Sick man! I love your improvements to this game.
When you speak, I think to Gary from Final space.
Your videos are awesome! Thanks a lot for your work
Was waiting for this video, and now it's finally out! BTW you should also do a video where you use RayLib to make a 3D platformer game (?)
your videos are so entertaining i had to be early when it came out
It feels amazing to be a part of your video! ❤️
You make this with just code. Amazing.
Have you heard of enums? its a useful feature, for example you can use an enum for the enemy type instead of unsigned char.
It makes the code more readable
TH-cam recommended this to me! This channel really is a hidden gem!! I'm currently learning sfml and c++ myself. One question: for how long have you been programming or learning c++ and sfml? I'm wondering because I'm learning it myself. Thanks! And subscribed! :)
Glad you liked it! I've been learning C++ for 3 years I think.
i think its better to always just check the first element in the vector of bullets to see if its out of bounds, and if so then remove it.
this way you dont have to check the entire vector each time
Underrated bro
That was awesome keep it man , love c++
Nice! Been waiting for this video!
4:30 Instead of asking yourself whether or not youre committing an unforgiable sin, I would call that return by value function an unforgivable sin.
Always return by reference if possible.
Why is that?
@@Kofybrek You basically avoid unnecessary copying.
In C++ you can either return by value or by reference. If you want to return by reference, you use the & symbol as you showed in the video. Otherwise your function will always return by value.
The difference between return by value and return by reference is that return by value returns a copy of your actual data and return by reference returns the actual data itself without any additional copying.
Let's say you have these functions:
std::string GetName() { return m_Name; }
std::string& GetName() { return m_Name; }
Both functions simply return the m_Name variable, however the first function returns by value and the second one returns by reference.
The first one will actually allocate additional memory to make a copy of the m_Name string and then return this copy.
The second function will return the actual m_Name variable, hence allowing you to modify (or not if you don't need to) that data without any extra memory allocations.
Imagine you have a vector with 1000 of elements. If you want to modify the actual vector outside of the class that owns it, you HAVE TO return by reference, because modifying a copy doesn't change the original data, obviously.
But even if you just want to read the data, you should return by reference to avoid unnecessary copying/memory allocations.
The reason for that is that these unnecessary memory allocations will have an impact on your performance. Obviously the code in this video would not suffer from return by value functions, because your program is very small. However, it is good coding practice to remember to return by reference if possible.
I hope I made this a bit more clear now to you :D
Very good! Happy new year!!!
That moment when the project gets to "Make It Pretty" 🤩🤩🤩
I think it'd be better if you went into more detail about the less commonly known things, like how you drew animations or why you used std::clamp (I've never seen anyone else use it). But I'm dumb so maybe not
can i use this for reference. i have school project
thanks
Can you make an akinator using sfml?
can you make your own version of hearthstone?
but could you also still do galaga tho....
Hi, @Kofybrek, can you make an Angry Birds clone using C++, SFML and Box2D?
I never worked with Box2D but I'm interested in learning it. I'll definitely do it!
very cool 👍
how do you fire? it doesnt fire im on win 10
May I ask, why do you use chars instead of integers and why are all the variables unsigned?
char variables takes less memory than int variables. I make them unsigned because I don't need them to be negative.
@@Kofybrek Ah, in Java I don't worry about these things...
Also, where did you learn sfml?
You forgot the barriers that protect the player and injure the aliens, in the ps1 game you could move them up when you hit them and after a bunch of hits they blow up
Yeah, I realized that while I was editing the video.
Please make a video to configure sfml on visual studio and use Cmake file on VS. Very thanks!!!!
When are you going to do the Galaga video?
I don't know. Most people wanna see something else.
Finally
what is the application of sprites?
Aseprite.
I have always been interested with coding but never done anything because I cba to code
But I am very good with coding logic gates in scrap mechanic.
One thing I have made was the no internet game with TERRIBLE graphics because I cba lol
What program do you use to draw images?
Aseprite.
@@Kofybrek but is it free?
@@Aisbejsijdns Yes and no. You can buy it or you can compile the source code for free.
hello the spaceship doesnt fire it only moves
Z key fires and thee is no auios it scomples to add the rquired files anc code
11:55 Why not?
how much time one game take to make?
It depends on the complexity of the game. Usually 1 week (if I don't procrastinate).
@@Kofybrek op brother❤️
Me watch start now
guh-loga
Bro can you please show the full code
The link to the Github repo is in the description.
Great video bro. could you share the cpp file of this code.
It's in the description.
i was play that thing
first