Squash (pong mod)
|
This is sort of a late blog post due to a busy weekend, so I’m posting now. (Sorry if the language is confusing somewhere) Last week we learned some fundamentals of programming by creating the simple game Pong. Allthough the simplicity I think I’ve learned alot from that! I’ve been tweeking around on the Pong-code we did and made my own little game: Squash (it’s not complete though)
Every time a player strikes the ball the paddle of the opposite player moves up a step indicating it’s their turn, plus that the color of their paddle is enhanced. Here’s the thing.. Each time a paddle moves up the game windows height is decreased. The longer the game is going the more difficult it is to save the ball from going out of bounds. Here’s an example to show what I mean: 1. 2. 3. I’ts pretty late right now when I’m writing this so I’m not going into the details too much on the code, but for resizing the window I used the method SDL_SetWindowSize(SDL_Window * window, int w, int h) which is called when the collision between the ball and the player is true. I also used an enum to tell which players turn it is. There’s of course alot more but I’ll probably going into more technical stuff on other post. I hope this was somewhat interesting to read! |



