Snake Game Tutorial 14a
Re: Snake Game Tutorial 14a
Yea, in Snek I restrict the use of Location for positions on the game grid.
Later on in Memesweeper, I create a class Vei2 (2D integer vector type) and I use it for both position on screen and position on the game grid. When I do this, I try to make it clear in the variable name what the usage of the Vei2 is (screen or grid).
Later on in Memesweeper, I create a class Vei2 (2D integer vector type) and I use it for both position on screen and position on the game grid. When I do this, I try to make it clear in the variable name what the usage of the Vei2 is (screen or grid).
Chili
Re: Snake Game Tutorial 14a
Can't wait to start studying this. One of my favorite games from many years ago when games were really simple.
I used to beat all my friends. You could play two players against each other, each controlling a snake - 2 snakes on the screen, sitting side by side and using different keys on the same keyboard. You'd not only try to collect objects but also try to trap the other guy's snake to kill him. Lots of fun times.
If I'm remembering right, the one I used to play was developed with Qbasic and was coming as part of the MS-DOS package.
I used to beat all my friends. You could play two players against each other, each controlling a snake - 2 snakes on the screen, sitting side by side and using different keys on the same keyboard. You'd not only try to collect objects but also try to trap the other guy's snake to kill him. Lots of fun times.
If I'm remembering right, the one I used to play was developed with Qbasic and was coming as part of the MS-DOS package.
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Snake Game Tutorial 14a
Multibyte wrote:Can't wait to start studying this. One of my favorite games from many years ago when games were really simple.
I used to beat all my friends. You could play two players against each other, each controlling a snake - 2 snakes on the screen, sitting side by side and using different keys on the same keyboard. You'd not only try to collect objects but also try to trap the other guy's snake to kill him. Lots of fun times.
If I'm remembering right, the one I used to play was developed with Qbasic and was coming as part of the MS-DOS package.
NIBBLES, that was my first programming experience. I did the same thing making it 3 player so my two bros could play along.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: Snake Game Tutorial 14a
Yes, it was NIBBLES. I had forgotten the name.albinopapa wrote:Multibyte wrote:Can't wait to start studying this. One of my favorite games from many years ago when games were really simple.
I used to beat all my friends. You could play two players against each other, each controlling a snake - 2 snakes on the screen, sitting side by side and using different keys on the same keyboard. You'd not only try to collect objects but also try to trap the other guy's snake to kill him. Lots of fun times.
If I'm remembering right, the one I used to play was developed with Qbasic and was coming as part of the MS-DOS package.
NIBBLES, that was my first programming experience. I did the same thing making it 3 player so my two bros could play along.
Re: Snake Game Tutorial 14a
Just as a side note, why are we making a grid for the snake game? Why not finetune it?
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Snake Game Tutorial 14a
Zedtho wrote:Just as a side note, why are we making a grid for the snake game? Why not finetune it?
What do you mean fine tune it?
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com
Re: Snake Game Tutorial 14a
I imagine he means, why not allow the position of the snake to be more fine-grained. The main reasons are: 1) the original snake game is done on a relatively coarse-grained grid and 2) I wanted to introduce the ideas of grid-based games because it's a pattern that appears extremely frequently in games.
Chili
Re: Snake Game Tutorial 14a
Thanks!
Yeah I couldn't find the right word to describe what I meant, sorry
Yeah I couldn't find the right word to describe what I meant, sorry
Re: Snake Game Tutorial 14a
Hey guys! New to this forum and programming in general.
I've just finished going through tutorial 14a and I tried writing the code up till that point but I'm unable to build the code successfully.
The constructor for snake::snake has an error that reads "the default constructor of "Snake::Segment" cannot be referenced -- it is a deleted function".
Why is the compiler referencing the default constructor of Snake::Segment to construct the snake::snake class?
I've tried replicating the code to be identical to the one shown in tutorial 14a and the error is still there.
Here's the output when i tried to build it:
1>------ Build started: Project: Engine, Configuration: Debug x64 ------
1>Snake.cpp
1>c:\users\Adagio\desktop\t14-snek-start\engine\snake.cpp(5): error C2280: 'Snake::Segment::Segment(void)': attempting to reference a deleted function
1>c:\users\Adagio\desktop\t14-snek-start\engine\snake.h(20): note: compiler has generated 'Snake::Segment::Segment' here
1>c:\users\Adagio\desktop\t14-snek-start\engine\snake.h(20): note: 'Snake::Segment::Segment(void)': function was implicitly deleted because a data member 'Snake::Segment::loc' has either no appropriate default constructor or overload resolution was ambiguous
1>c:\users\Adagio\desktop\t14-snek-start\engine\snake.h(18): note: see declaration of 'Snake::Segment::loc'
1>Done building project "Engine.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What's the problem here?
I've just finished going through tutorial 14a and I tried writing the code up till that point but I'm unable to build the code successfully.
The constructor for snake::snake has an error that reads "the default constructor of "Snake::Segment" cannot be referenced -- it is a deleted function".
Why is the compiler referencing the default constructor of Snake::Segment to construct the snake::snake class?
I've tried replicating the code to be identical to the one shown in tutorial 14a and the error is still there.
Here's the output when i tried to build it:
1>------ Build started: Project: Engine, Configuration: Debug x64 ------
1>Snake.cpp
1>c:\users\Adagio\desktop\t14-snek-start\engine\snake.cpp(5): error C2280: 'Snake::Segment::Segment(void)': attempting to reference a deleted function
1>c:\users\Adagio\desktop\t14-snek-start\engine\snake.h(20): note: compiler has generated 'Snake::Segment::Segment' here
1>c:\users\Adagio\desktop\t14-snek-start\engine\snake.h(20): note: 'Snake::Segment::Segment(void)': function was implicitly deleted because a data member 'Snake::Segment::loc' has either no appropriate default constructor or overload resolution was ambiguous
1>c:\users\Adagio\desktop\t14-snek-start\engine\snake.h(18): note: see declaration of 'Snake::Segment::loc'
1>Done building project "Engine.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What's the problem here?
Re: Snake Game Tutorial 14a
You're missing the default constructor for the segment
You want like Segment() = default;
You want like Segment() = default;
Chili