I have a basic BGE snake game, with the parts of the snake being spheres. It works, except I can't get the tail spheres follow the head... I have the original sphere moving and spawning spheres when it collects the red spheres, but I don't know how to make them follow in the exact path which the original sphere took...

Here's a link to the file:


  • $\begingroup$ As in your previous post I suggested using module mode if you are going to use global vars. snekfollow(controller) can be used as an entry point in Snake.py (ie could put all code in Snake.py). If you make a simple global list snake = ["Sphere"] (head only) and append the tail to the list every time you collect, eg after first snake.append("Sphere.001") in Snake.snekfollow(cont) then list is ["Sphere", "Sphere.001"] Each tail in list can be given the location of the previous in Snake.main() before you set the new location of the head. $\endgroup$ – batFINGER Jul 15 '16 at 8:05
  • $\begingroup$ I'm really confused by your comment, but only because I'm a noobie. So what you're saying is that I can put all of the code in Snake.py and then I only need the python controller in the Sphere object's logic area? I'm also confused about the method of updating location... Would I have to abandon the own.applyMovement() function? Or am I missing something? Instead of the own.applyMovement() method, I'm thinging I could have two location variables and change the x/y by .2, then update the location. But then I don't think I can use this with the tail without having a bagillion variables... $\endgroup$ – arduinoob Jul 15 '16 at 14:54
  • $\begingroup$ No need for a bagillion variables?..No need to abandon the own.applyMovement() method? Instead of a separate script file for each of your game controllers you can use an entry point eg Snake.add_tail(controller) eg def add_tail(controller): function in the Snake.py module. All your global vars would also be available to it. Check out blenderartists.org/forum/… $\endgroup$ – batFINGER Jul 15 '16 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.