Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post Posted: March 19th, 2017, 7:59 am 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3233
Location: Japan
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).

_________________
Chili


Top 
 Profile  
Reply with quote  
 Post Posted: March 19th, 2017, 5:40 pm 
User avatar

Joined: September 17th, 2013, 5:55 am
Posts: 30
Location: USA
Can't wait to start studying this. One of my favorite games from many years ago when games were really simple. :D

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. :lol:

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.


Top 
 Profile  
Reply with quote  
 Post Posted: March 19th, 2017, 11:04 pm 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2474
Location: Oklahoma, United States
Multibyte wrote:
Can't wait to start studying this. One of my favorite games from many years ago when games were really simple. :D

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. :lol:

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


Top 
 Profile  
Reply with quote  
 Post Posted: March 20th, 2017, 2:16 am 
User avatar

Joined: September 17th, 2013, 5:55 am
Posts: 30
Location: USA
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. :D

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. :lol:

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.


Yes, it was NIBBLES. I had forgotten the name. :)


Top 
 Profile  
Reply with quote  
 Post Posted: March 21st, 2017, 6:45 pm 
User avatar

Joined: February 14th, 2017, 7:32 pm
Posts: 92
Just as a side note, why are we making a grid for the snake game? Why not finetune it?


Top 
 Profile  
Reply with quote  
 Post Posted: March 21st, 2017, 7:43 pm 
 

Joined: February 28th, 2013, 3:23 am
Posts: 2474
Location: Oklahoma, United States
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


Top 
 Profile  
Reply with quote  
 Post Posted: March 22nd, 2017, 1:09 am 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3233
Location: Japan
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


Top 
 Profile  
Reply with quote  
 Post Posted: March 22nd, 2017, 6:03 am 
User avatar

Joined: February 14th, 2017, 7:32 pm
Posts: 92
Thanks!
Yeah I couldn't find the right word to describe what I meant, sorry


Top 
 Profile  
Reply with quote  
 Post Posted: April 13th, 2017, 11:29 am 
 

Joined: April 13th, 2017, 11:07 am
Posts: 5
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?


Top 
 Profile  
Reply with quote  
 Post Posted: April 13th, 2017, 2:10 pm 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3233
Location: Japan
You're missing the default constructor for the segment

You want like Segment() = default;

_________________
Chili


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 49 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

Board index » Everything


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: