Skip to content

MateusVega/GameToSenaiExpo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Platformer Game

Welcome to the Platformer Game repository! This project is a platform game developed in Python using the Pygame library.

Features

  • Graphics and sound with Pygame
  • Interactive menu
  • Ranking system
  • Player movement and animations
  • Collision detection
  • Item collection

Setup

To get started, install the necessary dependencies:

pip install pygame

How to Play

Run the main script to start the game:

python main.py

Code Details

The code is organized into the following sections:

Imports

Imports essential libraries like Pygame, sys, random, time, and serial (unused ones have been removed).

Configuration

Sets the Pygame window title and gets the screen size.

Menu Function

Creates a menu screen with a background image, title, and buttons to play or quit the game. Uses the Button class to handle button interactions.

Ranking Function

Displays a ranking screen with player names and times. Opens a text file to read and display existing rankings. Uses the get_font function to create text objects.

Player Name Input Function

Prompts the user to enter their name using a text input box. Uses the get_font function to create text objects.

Update Ranking Function

Reads existing ranking data from a text file. Updates the ranking with the new player's name and time. Sorts the ranking data based on time.

Map Loading Function

Reads a map file and creates a 2D list representing the game map.

Animation Functions

Loads animation sprites from a directory. Sets animation frames and durations. Creates a dictionary to store animation data.

Game Loop

Initializes the game window and sets up the clock. Loads game assets (images, sounds, fonts). Defines variables for player movement, jumping, and game state. Enters the main game loop:

  • Processes user input (keyboard) for movement and jumping
  • Updates player position based on movement and collisions
  • Handles jump logic (gravity and jump height)
  • Renders game elements: background image, coins and other collectibles, animated player character, text for score and timer
  • Detects collisions with obstacles and collectibles
  • Manages level transitions and end game conditions

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

See the code on GitHub

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages