Python Forum
[PyGame] Made my first Python program: Snake. Please help me improve it
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] Made my first Python program: Snake. Please help me improve it
#6
(Feb-18-2019, 10:53 PM)metulburr Wrote: I do not know what you mean? When i run it it seems fine. Can you explain?
It only moves in 1 cicle out of delay+1. If you press the direction keys only during cycles when the snake doesn't move, the snake won't turn. That isn't usually a problem except for when you want 180ยบ turns like UP->LEFT->DOWN with no space in between. In the beginning levels it's quite hard to achieve.

(Feb-18-2019, 11:03 PM)metulburr Wrote: I would only put movement within this if condition. You only want to limit movement, not eating or changing it size.
Can't do that or eventually you'll start popping from an empty list.
Reply


Messages In This Thread
RE: Made my first Python program: Snake. Please help me improve it - by andrerocha1998 - Feb-18-2019, 11:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how to add segments to the snake body blacklight 1 2,975 Sep-13-2023, 07:33 AM
Last Post: angelabarrios
  [PyGame] Snake game: how to get an instance for my snake's body multiple times? hajebazil 2 2,234 Jan-30-2022, 04:58 AM
Last Post: hajebazil
  help with snake game blacklight 3 2,680 Jul-30-2020, 01:13 AM
Last Post: nilamo
  Snake Game - obstacle problem Samira 3 5,780 Oct-31-2019, 02:58 PM
Last Post: Samira
  Creating Snake game in Turtle Shadower 1 8,706 Feb-11-2019, 07:00 PM
Last Post: woooee
  [PyGame] Basic Snake game (using OOP) PyAlex 1 12,656 Sep-10-2018, 09:02 PM
Last Post: Mekire
  [PyGame] Snake not changing directions in Snake Game Bjdamaster 4 5,062 Aug-13-2018, 05:09 AM
Last Post: Bjdamaster
  [PyGame] Snake controls not working jakegold98 5 6,577 Dec-12-2017, 01:45 AM
Last Post: Windspar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020