Learning C Game Programming – Simple Gun Shooting

https://vertostudio.com :: http://twitter.com/mlfarrell3d
Game code: http://vertostudio.com/pub/learnc/contro.zip

Espresso-C aided tutorial on programming shooting projectiles in a 2D game


Kim Jong-un says:

I’m now programming in C for about 3 months and i felt like I’m the only person whos code isn’t working right after compiling the first time… but It’s good to see that other have problems too.

MP S says:

Nice tutorial, needs more (and smaller) functions.

Codebuzz says:

Simple digital clock program

Ghaith Ben Hassine says:

Supportt like and click the ad ink keep Going man you are the Best <3

pspppe says:

Cool Stuff. @VertoStudio3D can u elaborate more on how u refresh and update the screen?

W Lee says:

I have Code::Blocks 17.12 IDE. I do not find all the libraries listed in this code. Where can I find them? I am a novice, therefore, a detailed info would be appreciated.

HE360 says:

This is an interesting tutorial. I do all of my coding in Java, JavaScript, BlitzBasic, and MonkeyX. I never really tried C nor C++ yet.

Siddhesh Dhawan says:

now make gta 5 on it

Max Mi says:

Hi, I getting erros, that SDL.h and SDL_image.h can not be found. I tried it with VS 2017 on Win

Neil Roy says:

*enemy.x+50* is an error. It should read *enemy.y+50*.

Kepler says:

Do it in plain C like a boss.

Peter Hronec says:

Is this game for 2 players?

Black Mamba says:

Why do you allocate memory fkr bullets when you defined MAX_BULLETS

Shiva Kumar says:

sir why is switch case not working in c graphics how to use switch case in c graphics

Preawpan Phh says:

what is ” -> ” idk plz :(

Árpád Goretity says:

The first valid array index is 0, you should be writing i >= 0. Also, free(NULL) is a safe no-op, you are only adding unneeded complexity by checking for NULL before freeing.

rich allen says:

Is there any way to program in this version of C on a Chromebook?

Pencil League says:

Mark jukarberg….

Miles The coder says:

I always thought that the array of bullets were assigned with curly braces because that’s the usual way of initialising an array say for example the same way you initialise an array like this:

char fruits[3] = { “Oranges”, “Peaches”, “Banana”, “Mango” };

Does it have anything to do with the fact that it’s a pointer?

Lynn Minmay says:

I do not have sdl.h

Everything Geek says:

This is so cool.. props man!

ridhwaan any says:

this is best thank you for doing C

DIA D RPG says:


Sam Cheshire says:

I want to learn coding especially c and c++ for a video game that I am making. Can you let me know how you learnt it and what is a good book to learn it from.

Fl4ts says:

In C11 when you create a function with variables from a struct, do you pass them ass pointers or references?

rana pratap says:

Is this c programming or c++ programming


it says error sdl.h no such file or directery

William Tubbs says:

leemie learn

Wicqed Eyebot says:

what? Did you just use C? That is awesome.

Georgie Pig says:


Don Foumare says:

Doesn’t “Bullet *bullets[MAX_BULLETS] = { NULL };” allready allocates enought memory space for all bullet structs?
Why do you use malloc() in ” bullets[i] = malloc(sizeof(Bullet)); ” inside the addBullet() function???

Aldaril Telvanni says:

idTech 1, 2 and 3 engine were written in C and games that are using it are Doom 1/2, Quake 2/3. You can develop games in pure C but you will need good skills. You can just use structs and pointers to mimic Class in OOP. structs can hold data types, other structs(which is basically advanced data type) and pointers to functions. You can make your code really nice. For example:

typedef struct Texture {
void (*LoadTexture)(struct Texture*);
void (*RenderTexture)(struct Texture*);
void (*Destructor)(struct Texture*);
const chat *path;
SDL_Texture *texture;
} Texture;

As you can see, Texture “class” holds everything you need. Later on you just place function pointers.

Texture background = { &LoadTexture, &RenderTexture, &DestroyTexture, “data/background.png” };

And then you can use your “object”.


Thats it, you don’t need classes.

Ti Ko says:

How can i download c programming from ?

Ashish Panchal says:

Hi can you tell me or make a video on How to perform an action using arrow keys in C?(not in C++ but in C)

Hua Zhang says:

very cool

Miles The coder says:

did you mean contra instead of contro

contro in Italian = against

contra = the video game

Árpád Goretity says:

The first valid array index is 0, you should be writing i >= 0. Also, free(NULL) is a safe no-op, you are only adding unneeded complexity by checking for NULL before freeing.


where can i get sdl header?

Jonathan Lance says:

is espresso-c there for windows?

Web Rockerz says:

plz send me this code i want to show this game for my project plzz,,… to my praticle

Δ Masakrator says:

Link with game code doesn’t work ;/

Miles The coder says:

Why are there times for your videos???

Ethan Barclay says:

no way you used the pacer test music

All Time Tech says:

u program on a mac

FirstInstruMentalist says:

“There is no dead, there is only alive 0”

Simple Developer says:

that udemy ad game programming is really pissing me off

Mustafa KHAN says:

i don’t clear my basic plz clear

Amornchot Singh says:

Where can I get the game assets so I can follow along?

Trang hoang thi kieu says:


Write a comment


Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.

Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles   Show Cars   Motorbikes   Scooters   Bicycles   Rims & Tires   Luxury BoatsFashion   Sunglasses   Luxury Watches   Luxury Purses   Jeans Wear   High Heels   Kinis Swimwear   Perfumes   Jewellery   Cosmetics   Shaving Helpers   Fashion Hats   Modeling TipsFooding   Chef Club   Fooding Helpers   Coktails & LiquorsSports   Sport Shoes   Fitness & Detox   Golf Gear   Racquets   Hiking & Trek Gear   Diving Equipment   Ski Gear   Snowboards   Surf Boards   Rollers & SkatesEntertainment   DIY Guides   Zik Instruments   Published Books   Music Albums   Cine Movies   Trading Helpers   Make Money   Fishing Equipment   Paintball Supplies   Trading Card Games   Telescopes   Knives   Vapes   GameplaysHigh Tech   Flat Screens   Tech Devices   Camera Lenses   Audio HiFi   Printers   USB Devices   PC Hardware   Network Gear   Cloud Servers   Software Helpers   Programmer Helpers   Mobile Apps   Hearing AidsHome   Home Furniture   Home Appliances   Tools Workshop   Beddings   Floor Layings   Barbecues   Aquarium Gear   Safe Boxes   Office Supplies   Security Locks   Cleaning ProductsKids   Baby Strollers   Child Car Seats   Remote ControlledTravel   Luggages & Bags   Airlines Seats   Hotel Rooms   Fun Trips   Cruise Ships   Mexico Tours