Object-Oriented Programming is what we are going to apply to this project in this episode of creating a chess game with React using TypeScript. We start by creating a class for the piece. This is very similar to the type piece but has one major difference which is that in a class it is possible to code logic.
The code in this video can be found on the Frontend Coding GitHub repository:
https://github.com/FrontendCodingYT/c...
Timestamps:
0:00 Welcome! Summary of what we are going to create.
0:58 Explaining! Why do we want a class?
3:20 Coding! Creating the piece class.
7:35 Coding! Removing piece Type and fixing references.
10:40 Coding! Using the new piece constructor.
13:37 Coding! Rewriting the rest of the pieces.
14:30 Coding! Automating the piece image URL.
16:08 Coding! Enhancing the enums.
17:48 Question! What is the image src?
19:40 Coding! Updating the inital pieces array.
21:30 Coding! Creating the position class.
22:40 Coding! Fixing the references.
26:10 Coding! Moving the samePosition function.
29:00 Coding! Using the position constructor.
30:55 Coding! Fixing the rest of the references.
41:17 Thanks for watching! See you next time :)