Skip to content

About

๐Ÿš— A 2D Car Dodge game built with C and BGI Graphics, demonstrating computer graphics concepts like 2D coordinates, shapes, animation, object movement, and collision detection.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

ย 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš— Car Dodge โ€“ 2D Computer Graphics Game

A 2D Computer Graphics project developed to demonstrate fundamental graphics concepts through an interactive car-dodging game.

Project live on - " https://car-dodge-2d-game.vercel.app/ "

๐Ÿ“Œ About

This project is a simple Car Dodge game developed using C and BGI graphics.h.

The player controls a green car and moves it left or right to avoid incoming traffic. The game demonstrates important Computer Graphics concepts such as 2D coordinates, geometric shapes, object movement, animation, color, and collision detection.

โœจ Features

  • ๐Ÿš— Player Car โ€“ Control the green car using keyboard input
  • ๐Ÿ›ฃ๏ธ Road Animation โ€“ Moving lane markings create a driving effect
  • ๐Ÿš˜ Traffic Cars โ€“ Random traffic cars appear on different lanes
  • ๐ŸŽฎ Keyboard Controls โ€“ Use Left/Right Arrow keys or A/D
  • ๐Ÿ† Score System โ€“ Score increases as the player survives
  • ๐Ÿ’ฅ Collision Detection โ€“ Detects when the player hits another car
  • ๐Ÿ”„ Restart Game โ€“ Play again after a crash
  • โšก Increasing Difficulty โ€“ Traffic speed increases as the game continues
  • ๐ŸŽจ Graphics Drawing โ€“ Cars and road are created using basic shapes

๐Ÿง  Computer Graphics Concepts

๐Ÿ“ 2D Coordinates

The game uses X and Y coordinates to position the player car, traffic cars, road, and other objects on the screen.

  • X-axis โ†’ Controls horizontal position
  • Y-axis โ†’ Controls vertical position

๐Ÿ”ท Geometric Shapes

Cars and road elements are created using basic graphical shapes such as:

  • Rectangles
  • Lines
  • Filled shapes

These simple shapes are combined to create the game objects.

๐Ÿ”„ Object Movement

The player's X-position changes when the user presses the control keys.

Traffic cars and road markings move vertically by changing their Y-position.

๐ŸŽž๏ธ Animation

The game continuously updates and redraws the scene to create movement.

Keyboard Input
      โ†“
Move Player
      โ†“
Move Traffic
      โ†“
Update Road
      โ†“
Update Score
      โ†“
Draw Scene
      โ†“
Check Collision
      โ†“
Continue / Game Over

๐Ÿ’ฅ Collision Detection

The program checks whether the player's car overlaps with an incoming traffic car.

If the two cars overlap, a collision is detected and the game ends.

๐ŸŽฎ Game Controls

Key Action
โฌ…๏ธ Left Arrow / A Move Left
โžก๏ธ Right Arrow / D Move Right
โŽ‹ ESC Quit the Game

๐Ÿ† Scoring

The score increases continuously while the player survives.

The longer the player avoids traffic, the higher the score becomes.

๐Ÿ› ๏ธ Technologies

  • C โ€“ Game programming
  • BGI graphics.h โ€“ Computer graphics and drawing
  • conio.h โ€“ Keyboard input
  • dos.h โ€“ Timing and delay functions
  • Turbo C / WinBGIm โ€“ Compatible environments for running the project

๐Ÿ“ Project Structure

โ”œโ”€โ”€ car_dodge.c
โ”œโ”€โ”€ index.html
โ”œโ”€โ”€ project-explanation.md
โ””โ”€โ”€ README.md

๐Ÿ”„ Project Workflow

Start Game
     โ†“
Control Player Car
     โ†“
Avoid Traffic
     โ†“
Traffic & Road Animation
     โ†“
Increase Score
     โ†“
Collision Detection
     โ†“
Game Over
     โ†“
Play Again / Exit

The project demonstrates how basic Computer Graphics concepts can be combined with programming logic to create an interactive 2D game.

๐Ÿ‘จโ€๐Ÿ’ป Team

Member GitHub
Devarsh @dp0503
Dhruv @dhruvkabra05
Krishna @krishnaa0212
Prishi @Prishii17
Vishesh @visheshjainz

๐ŸŽ“ Academic Project

Developed as an academic Computer Graphics project to demonstrate:

C Programming + Computer Graphics + Animation + Collision Detection

About

๐Ÿš— A 2D Car Dodge game built with C and BGI Graphics, demonstrating computer graphics concepts like 2D coordinates, shapes, animation, object movement, and collision detection.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages