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

Comments

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:

https://youtu.be/QptbtcprC3U
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:

MJNJN

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

TECH REVIEWS says:

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:

simple?
S I M P L E? WDYM S I M P L E

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”.

background.LoadTexture(&background);
background.RenderTexture(&background);
background.Destructor(&background);

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.

MOHAMMAD ZOUBI says:

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:

G

 Write a comment

*

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

Please click below to support us on Facebook!