Another week, another update!
What I learned:
I could kind of improvise on how to position a big object in the middle of the screen. For example if the window width is 1280 and the board width is 150 I'd take half of 1280 which is 640 and subtract 150 from it and set it as the X coordinates of the board because the top left side of the object is the starting point
I also learned how to handle bounces in a somewhat easy way which I'll talk about in a later section
Problems I faced:
And I faced quite difficult ones! Firstly it's not really a problem but I would always forget to call the functions after making them. Then when I'd run the code I'd be surprised that why something isn't working
Another one, which I mentioned earlier was the collision of the ball with the player board and the window. This one took the most brain work out of me and took a while for me to come up with a solution that would meet my standards.
Never would I ever thought that it would be as simple as flipping the axis of the velocity vector I implemented for movement speed of the ball. Surprisingly, it did the job! And I haven't found a problem with that approach yet so in the end it's all good!
What now?
Good question, friend. Now I wanna implement more things to it that I have in mind such as: PLAYER 2 and it's controls, probably a net and a "field" between the 2 players, and in general a touch up to the whole game to make it look more like a 2 player tennis game.
A lot of changes will have to be made to the existing code but I'm excited for it!
Until next week, stay safe, and take care of yourselves!
Top comments (0)