The Cloud Avoidance Game is a simple arcade-style project where players move a rectangle across the screen while avoiding moving clouds. Built with Python and Pygame, it includes a start menu, step-based movement controls, animated cloud obstacles, and collision detection that ends the game on impact.
Languages Used:
Frameworks/Technologies Used:
Key Features:
Object-Oriented Game Architecture
-
The entire program is organized around a Game class that encapsulates initialization, state management, event handling, updates, and rendering.
-
Core components—player movement, cloud animation, collision checks, and drawing—are implemented as methods, demonstrating clean OOP structure and encapsulation.
-
Game data such as the player, clouds, images, and positions is stored as instance attributes, reinforcing object-managed state.
Event-Controlled Game Loop
-
The game uses an event-driven loop that runs until a quit event or collision occurs.
-
User interactions (movement keys, window close events) are processed inside a dedicated event-handling method, keeping input logic cleanly separated.
-
The loop follows a structured pipeline each frame: process events → update objects → detect collisions → draw frame → refresh display.
Player Movement & Input Handling
-
The player’s position is updated through method-based logic that responds to keyboard input captured from Pygame’s event queue.
-
Movement is step-based and bounded by screen limits, demonstrating state validation and controlled updates.
Cloud Obstacle System
-
Clouds are stored in a dictionary, and each cloud’s motion is updated every frame inside the Game loop.
-
The Game class handles cloud movement, bouncing behavior, and sprite rendering, showing the use of lists/dictionaries in an object pipeline.
Collision Detection & Game Flow
-
Collision checks compare player and cloud rectangles during each loop iteration.
-
A collision cleanly ends the event loop by updating the Game state, demonstrating proper loop control and termination logic.
Rendering Pipeline & Assets
-
The Game object loads images (background and clouds), scales them, and renders all objects each frame through a centralized draw method.
-
This showcases the use of Pygame’s rendering pipeline within an OOP-controlled structure.