From Python to Physics: How I Built a Chrome Dino Clone in 24 Hours (Scaler YIIC Task 5)

Published: (January 5, 2026 at 08:12 AM EST)
2 min read
Source: Dev.to

Source: Dev.to

From AI to Game Dev

As a Python and AI developer (and a Class 12 student), I usually work with data pipelines and backend logic. For Task 5 of the Scaler Young India Innovation Challenge (YIIC 6.0), we were asked to recreate the iconic Chrome Dino Run game using the Unity Engine. This required a shift from my usual tech stack to Unity 6 (LTS) with the 2D Core template.

Core Components

  • Dino – Sprite with a Rigidbody2D (gravity) and a BoxCollider2D (collision).
  • Ground – Static object tagged as "Ground" so the Dino knows when it can jump.
  • Enemy – Red triangle spike that moves left using a Kinematic body.

The hardest part was handling physics and logic, especially preventing double jumps or unintended flight.

Jump Logic

// Simple Jump Logic
if (Input.GetKeyDown(KeyCode.Space) && isGrounded)
{
    rb.velocity = Vector2.up * jumpForce;
    isGrounded = false;
}

The script checks the ground tag with CompareTag before allowing a jump.

Spawner Logic

To generate an endless stream of enemies, I created a Spawner.cs script that uses Time.deltaTime. Every few seconds it instantiates a new enemy prefab at the screen edge.

// The Spawner Logic
void Update()
{
    timer += Time.deltaTime;
    if (timer >= spawnRate)
    {
        SpawnEnemy();
        timer = 0f; // Reset timer
    }
}

Tweaking Physics

Initially the Dino felt “floaty” – it stayed airborne too long and was hard to control. The adjustments made the movement snappy and responsive, matching the original Chrome game:

  • Gravity Scale: increased to 3.
  • Jump Force: set to 7.

Conclusion

This task demonstrated that engineering principles transfer across domains. Whether using Python for AI or C# for Unity, the key is breaking a large problem (a game) into small, solvable logic blocks (gravity, collision, loops).

Task 5 complete! Next stop: final submission.

#GameDev #Unity #StudentDeveloper #CodingJourney

Back to Blog

Related posts

Read more »

The RGB LED Sidequest 💡

markdown !Jennifer Davishttps://media2.dev.to/dynamic/image/width=50,height=50,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%...

Mendex: Why I Build

Introduction Hello everyone. Today I want to share who I am, what I'm building, and why. Early Career and Burnout I started my career as a developer 17 years a...