c++ - How can i make snake elongate when colliding with an object? -
i have controllable snake head shape responds input , have shapes drawn onto game board. have @ code , me out additions/amendments can make make snake grow when intersects 1 of spawned shapes?
all project files on pastebin: http://pastebin.com/u/addsy
thanks.
you store snake's body parts in linked list in snake's class. rendering boil down iterating on list , rendering each part separately. moving, once have direction, move head, , move every body part in list position of 1 before it. example, head moves first, first part moves previous position of head, second part position of first part , forth. elongate snake, on move, create 1 more node @ end of list, position of tail before movement.
Comments
Post a Comment