Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#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