• Create Account

Banner advertising on our site currently available from just \$5!

### #Actualmolehill mountaineer

Posted 26 August 2013 - 03:43 AM

Hi,

I realize that this may make me sound like a jerk so let me clarify that that is absolutely not my intention.

If you want people to help you debug your code it is essential that you make it as easy for them to understand it as possible.

To that end, you should post a few screenshots depicting the problem you're having. No offense, but I'd rather not download and run any ol' exe file.

It would also be helpful if you explained the algorithm you're using to position the segments of the snake's body, as well as including a few comments in the code you posted.

- why do you subtract 8 from the length when positioning the node?

- what is the purpose of the counter datamember attached to node 0 ?

As I understand it, you're using the vector [previous segment -> current segment] to position the current segment? I may be wrong, but I think you'll want to go from head to tail in that scenario. That is, instead of

for(int x = 0; x < nodes.size(); ++x)

use

for(int x = nodes.size() - 1; x >= 0; --x)

### #1molehill mountaineer

Posted 26 August 2013 - 03:37 AM

Hi,

I realize that this may make me sound like a jerk so let me clarify that that is absolutely not my intention.

If you want people to help you debug your code it is essential that you make it as easy for them to understand it as possible.

To that end, you should post a few screenshots depicting the problem you're having. No offense, but I'd rather not download and run any ol' exe file.

It would also be helpful if you explained the algorithm you're using to position the segments of the snake's body, as well as including a few comments in the code you posted.

- why do you subtract 8 from the length when positioning the node?

- what is the purpose of the counter datamember attached to node 0 ?

As I understand it, you're using the vector [previous segment -> current segment] to position the head of the snake?

PARTNERS