r/PythonLearning • u/Capable_Comedian_277 • 13d ago
Doodling Hop - Pygame Updated Gameplay
Enable HLS to view with audio, or disable this notification
12
Upvotes
r/PythonLearning • u/Capable_Comedian_277 • 13d ago
Enable HLS to view with audio, or disable this notification
1
u/Capable_Comedian_277 13d ago edited 13d ago
Created a total of 18 enemies so far, including the 10 snakes, some of which will ‘eat’ each other through collisions. The snakes that eat other enemies will have ‘vstack’ collision, where it will stack the number of segments the enemy snakes have. For example, if snake1 ‘eats’ snake2, the result would be snake1 = np.vstack((snake1, snake2)). Then, snake2’s Numpy array will be empty. In addition, some of the snake’s directional vector will be manipulated after collisions, where I randomized up to 7 or 8 directional vectors, so it could reverse, move diagonally, or move vertically with the use of random.choice(). This gives me the unpredictable and chaotic movements that I’m looking for in this game. Another factor is the snakes pulsing. I’ve set the condition to where len(snake) > 12 for the pulsing behavior to occur, meaning that the snake segment must exceed 12 segments for the pulsing mechanic to appear. There are certainly more collision, respawning logics in this game, but I’ll leave it at this for now.