Snek Game

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
sheriff40
Posts: 7
Joined: August 19th, 2017, 10:21 am

Snek Game

Post by sheriff40 » August 27th, 2017, 3:13 pm

I have done the snek game upto the tutorial 14a. I tried debugging the code but couldn't get any solution. When i run the program, the screen just goes white. The snek game is not fully complete, but it's upto the point where you can actually move the snake and make it grow. here's the repository:
https://github.com/Sheriff40/GitSnek
thank you!! :D

jamesmfox
Posts: 15
Joined: September 1st, 2017, 10:46 pm
Location: Mississippi, USA

Re: Snek Game

Post by jamesmfox » September 4th, 2017, 12:59 am

Welcome to PlanetChili. And to programming

I took a look at your code.
I am new to programming too so ya know still might not work :D
But i found a couple error in your typography

Code: Select all

// Snake.cpp
//In your Snake::Segment::InitHead()
Color c = HeadColor;

// Should be
c = HeadColor;

// And in your Snake::Draw()
for ( int i = 0; i < MaxSegments; i++)

// When you first draw your snake you dont have all of the segments location and color set up
// Should be
for (int i = 0; i < nsegments; i++)
One more

Code: Select all

//Location.h
//Location::Add()
//You are just setting the x and y to val.x and val.y
x = val.x;
y = val.y;

// Should be
x += val.x;
y += val.y;

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Snek Game

Post by chili » September 5th, 2017, 1:33 am

Seems like you had a few problems there. Thanks to james for sussing that stuff out!

Try these fixes first and see if that solves your shit. Otherwise update your repo and we'll take another look. Good job posting github btw, that's how you get help.
Chili

Post Reply