Logo Lanfrica

cailabridges/mamba-game

Type de record:

software
Créateur:
cai
Hôte:
A real african spin to the classic snake game. # Mamba Game ## Table of Contents * About * Video * Technologies * Code Examples * Features * Status * Why Mamba Game * Contact ## About Mamba Game The Mamba game offers a unique African twist on the classic snake game, immersing players in the vibrant ecosystem of Africa. As players use their keys to maneuver the hungry snake to find its prey, they not only enjoy the thrill of the game but also gain valuable insights about the natural world. The game integrates educational elements, such as intriguing fun facts about snakes and the African green mamba, to become an engaging learning platform for young and old alike. ## Mamba Game Walkthrough Video Mamba Game Walkthrough Video ## Technologies Python ## Code Examples ``` def next_turn(snake, food): global score x, y = snake.coordinates[0] if direction == "up": y -= SPACE_SIZE elif direction == "down": y += SPACE_SIZE elif direction == "left": x -= SPACE_SIZE elif direction == "right": x += SPACE_SIZE snake.coordinates.insert(0, [x, y]) snake.update_head(direction) square = snake.canvas.create_image( x, y, anchor=NW, image=snake_head, tags="snake") snake.squares.insert(0, square) if x == food.coordinates[0] and y == food.coordinates[1]: global score score += 1 label.config(text="Score : {}".format(score)) canvas.delete("food") food = Food(canvas, snake.coordinates) else: del snake.coordinates[-1] canvas.delete(snake.squares[-1]) del snake.squares[-1] snake.update_tail() if check_collisions(snake): game_over() return window.after(SPEED, next_turn, snake, food) ``` ``` def check_collisions(snake): x, y = snake.coordinates[0] if x = GAME_WIDTH or y = GAME_HEIGHT - (SPACE_SIZE*2): print("GAME OVER") return True for body_part in snake.coordinates[1:]: if x == body_part[0] and y == body_part[1]: return True return False ``` ## Mamba Game Features * Incorporates education by providing interesting facts about snakes, including green mambas, at the end of the gameplay. * Offers immersive graphics, featuring hig …

Languages