game-example v1.0.0 (updated on 11/09/2018)
game-example must do/finish:
•add gun
•add life
•add zombies
•add touch screen support (which i want to try this, so you can play it without joycons!)
•port on Wii: see here
•port on WiiU
•port on Xbox 360
How did you start developing this?
changelog:
Download: https://github.com/Dontwait00/game-example/releases/latest
what is it?
first, is my first game im creating in C.
second, is a game made entirely on CONSOLE MODE with no graphics and no sound. I will create a GTA style game in 2D in the near future.
first, is my first game im creating in C.
second, is a game made entirely on CONSOLE MODE with no graphics and no sound. I will create a GTA style game in 2D in the near future.
CONTROLS:
UP = up
RIGHT = right
DOWN = down
LEFT = left
A = Unknown still
UP = up
RIGHT = right
DOWN = down
LEFT = left
A = Unknown still
game-example must do/finish:
•add gun
•add life
•add zombies
•add touch screen support (which i want to try this, so you can play it without joycons!)
•port on Wii: see here
•port on WiiU
•port on Xbox 360
How did you start developing this?
Heh, wasn't simple for me.
I started developing on useless programs, and i wanted to start something less useless to help others noob like me to try coding.
so then i started developing from scratch, using printf and other basic codes just to see want i could do.
And then i thought, if i could make a player to move up, down, left, right using variables.
My idea (which wasn't after i know it) was to use the rows and column as a player to move free
here's a concept:
Now, after a bit of theory, we need practice on it.
Lets start:
Now we can move the player UP, DOWN, RIGHT and LEFT.
But we still need the collision like the wall!
lets start:
I hope i helped you, if so, feel free to drop a like! thanks
I started developing on useless programs, and i wanted to start something less useless to help others noob like me to try coding.
so then i started developing from scratch, using printf and other basic codes just to see want i could do.
And then i thought, if i could make a player to move up, down, left, right using variables.
My idea (which wasn't after i know it) was to use the rows and column as a player to move free
here's a concept:
lets make a simple room 8x8:
W = wall
f = floor
P = player
.....r_o_w_s
c 0...1..2..3..4..5..6..7
o..1 W W W W W W W
l...2 W f...f...f...f...f...W
u..3 W f...f...f...f...f..W
m.4 W f...f...f...f...P..W
n..5 W f...f...f...f...f..W
....6 W f...f...f...f...f...W
....7 W W W W W W W
if i press up = [3][6] = floor, which means i can move
if i press right = [4][7] = wall, which means i cant move there
if i press down = [5][6] = floor, which means i can move
if i press left = [4][5] = floor, which means i can move
W = wall
f = floor
P = player
.....r_o_w_s
c 0...1..2..3..4..5..6..7
o..1 W W W W W W W
l...2 W f...f...f...f...f...W
u..3 W f...f...f...f...f..W
m.4 W f...f...f...f...P..W
n..5 W f...f...f...f...f..W
....6 W f...f...f...f...f...W
....7 W W W W W W W
if i press up = [3][6] = floor, which means i can move
if i press right = [4][7] = wall, which means i cant move there
if i press down = [5][6] = floor, which means i can move
if i press left = [4][5] = floor, which means i can move
Lets start:
...
// now lets start using int as variables
int a, b;
//then i need to operate like this to use rand()
srand(time(NULL));
//now i can use rand() to rand some numbers
a = rand() % 10;
b = rand() % 20;
//now i can assemble a and b to be the player.
//\x1b[r;cH is for printing on the screen where you want,
//which r stands for Rows and c for Columns
printf("\x1b[%d;%dHx", a, b);
//lets start doing the player move!
if (kDown & KEY_DUP) {
//now that we printed the player, we need to delete the footstep behind him
printf("\x1b[%d;%dH ", a, b);
a = a - 1;
//now lets move the player up!
printf ("\x1b[%d;%dHx", a, b);
}
//now we have to do this step every single step for every direction pad.
if (kDown & KEY_DDOWN) {
// so on
...
}
// now lets start using int as variables
int a, b;
//then i need to operate like this to use rand()
srand(time(NULL));
//now i can use rand() to rand some numbers
a = rand() % 10;
b = rand() % 20;
//now i can assemble a and b to be the player.
//\x1b[r;cH is for printing on the screen where you want,
//which r stands for Rows and c for Columns
printf("\x1b[%d;%dHx", a, b);
//lets start doing the player move!
if (kDown & KEY_DUP) {
//now that we printed the player, we need to delete the footstep behind him
printf("\x1b[%d;%dH ", a, b);
a = a - 1;
//now lets move the player up!
printf ("\x1b[%d;%dHx", a, b);
}
//now we have to do this step every single step for every direction pad.
if (kDown & KEY_DDOWN) {
// so on
...
}
But we still need the collision like the wall!
lets start:
...
//we need to compare the collision with a wall called X,
//so we need a new int
int wall_y;
int wall_x;
wall_y = 10;
wall_x = 10;
if (kDown & KEY_DUP) {
if (a == wall_y && b == wall_x) {
a = a + 1;
printf ("\x1b[%d;%dHX", wall_y, wall_x);
printf ("\x1b[&d;%dHx", a, b);
}
}
//so on with every direction pad
...
//we need to compare the collision with a wall called X,
//so we need a new int
int wall_y;
int wall_x;
wall_y = 10;
wall_x = 10;
if (kDown & KEY_DUP) {
if (a == wall_y && b == wall_x) {
a = a + 1;
printf ("\x1b[%d;%dHX", wall_y, wall_x);
printf ("\x1b[&d;%dHx", a, b);
}
}
//so on with every direction pad
...
i may written badly somewhere, feel free to DM me, thanks
changelog:
v0.1 - added player moving on screen; bugs everywhere
v0.3 - added collision! (was my first time using logic interpreters)
- fixed minor bugs, still a lot of bugs!
v0.5 - added wall using collision! (those XXXX are walls ;P)
v0.7 - fixed all the bugs like:
1) numbers printed on screen when touching end of the screen;
2) player disappearing from the screen;
3) collision worked only from the front of the player;
4) player now cant get out of the screen using collision.
5) ???
6) profit
v1.0.0 - just everything fixed
v0.3 - added collision! (was my first time using logic interpreters)
- fixed minor bugs, still a lot of bugs!
v0.5 - added wall using collision! (those XXXX are walls ;P)
v0.7 - fixed all the bugs like:
1) numbers printed on screen when touching end of the screen;
2) player disappearing from the screen;
3) collision worked only from the front of the player;
4) player now cant get out of the screen using collision.
5) ???
6) profit
v1.0.0 - just everything fixed
Download: https://github.com/Dontwait00/game-example/releases/latest
Last edited by Dontwait00,