new project started!
Posted: July 22nd, 2012, 3:20 pm
is a snake replica;
started it this morning ,worked about 6 h on it so far ,well most of it was thinking on how to do it .
anyway i choosed the linked list concept(with loop ) for the snake squares,made each square a class with it's own x,y coordinates and a pointer to next square(the color variables were for a different idea that would not make much use of the linked list idea).
so i got the snake going on the screen,colecting goal squares and increasing it's length.
the problem is when the head of the snake is right on the goal square and i change direction it skips the goal like it never passed over it ,and i made my code so that it actually attaches the goal square as the new head of the snake before even moving over it,dunno why is doing this..
also i know that i'm just creating new Sqr class objects with every snake update and never delete them ,that i intend to code later on(afterall is just a few bytes of memory leaking )
and also missing colision detection with the screen edge or the snake body,and it can turn 180degree's in one move:)
anyway i just uploaded it at this stage to get few ideas about how to make it eat goal and move without a pause like effect,i mean whenever the head is on the square next to the goal and it's heading towards the goal it should take the goal posiition and put it as the new head for the snake
so far is doing just that but only when i'm passing trough the goal,if i corner right on the goal spot it misses the goal and moves over:(
here's the source,has no comments so far,hope u can read it without them for now:D
started it this morning ,worked about 6 h on it so far ,well most of it was thinking on how to do it .
anyway i choosed the linked list concept(with loop ) for the snake squares,made each square a class with it's own x,y coordinates and a pointer to next square(the color variables were for a different idea that would not make much use of the linked list idea).
so i got the snake going on the screen,colecting goal squares and increasing it's length.
the problem is when the head of the snake is right on the goal square and i change direction it skips the goal like it never passed over it ,and i made my code so that it actually attaches the goal square as the new head of the snake before even moving over it,dunno why is doing this..
also i know that i'm just creating new Sqr class objects with every snake update and never delete them ,that i intend to code later on(afterall is just a few bytes of memory leaking )
and also missing colision detection with the screen edge or the snake body,and it can turn 180degree's in one move:)
anyway i just uploaded it at this stage to get few ideas about how to make it eat goal and move without a pause like effect,i mean whenever the head is on the square next to the goal and it's heading towards the goal it should take the goal posiition and put it as the new head for the snake
so far is doing just that but only when i'm passing trough the goal,if i corner right on the goal spot it misses the goal and moves over:(
here's the source,has no comments so far,hope u can read it without them for now:D