The story of making an Invaders game in C language

happy New Year

I don't think it's an article to write on ~~ 1/1, but I'll write a story about making a game in C language before the summer of last year (2018).

environment

OS:Ubuntu 18.04 Editor:VSCode Compiler:clang

I'm a person who uses Mac, Linux, and Windows, and I wanted to write source code that works in any environment, so I didn't have a specific environment, but I mainly wrote it in Ubuntu.

Completed form

Peek 2019-01-01 02-42.gif

~~ Shoboi ~~

Source code

https://github.com/hashitaku/MyInvaderGame

Operations, rules, etc.

--All operations are left-clicked with the mouse to fire a laser from the turret. --Move the mouse left and right to move the turret. --Three (changeable) lasers will be randomly emitted from the Invader side as well. ――When the Invaders move left and right and hit the wall, they gradually go down, and when they cross the light blue line, the game is forcibly over.

Creation process

Find out the basic usage of the library

I had never done anything with an external library, so I searched a lot on the net. The library called GLUT used this time was a very old library and had a lot of information, so it was helpful.

I will implement

There is no particular reason for making it an Invaders game, but I think it was good for me to make it individually because the goal was not so high. GLUT is a very convenient library and easy to use.

Difficulties

--Since the basics of game production were too lacking and I didn't know how to implement collision detection, I should have implemented an inefficient algorithm ... (I still don't know) ――I drew the Invaders dot by dot with GIMP, but it was very hard. -** Maintaining motivation **

Reflections

--The division between the header file and the source file is not clean (important) --I regret that it was not good to write everything in a god file called func.h ... --No source tree (easy to CMake ...) ――It cannot be said that the source code is beautiful.

Good points, points of growth

--I think variable names and function names are easy to understand (although they may be difficult to understand). --I learned that there are times when I have to use global variables --Achieved the goal of cross-platform production

Comprehensive evaluation

I think I did my best for the level of individual student production.

Next time I'm thinking of rewriting this game using C ++, GLFW, GLEW, etc.

Recommended Posts