Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
806 B
1
Indexable
Never
#include <graphics.h>
#include <iostream>

using namespace std;

int main() {
    int gd = DETECT, gm;
    initgraph(&gd, &gm, "");

    int x = 0;
    while (x < 600) {
        cleardevice(); // clears the screen
        // car body
        setcolor(WHITE);
        rectangle(x+50, 300, x+200, 250);
        line(x+50, 300, x+75, 350);
        line(x+200, 300, x+175, 350);
        line(x+75, 350, x+175, 350);
        // car windows
        setcolor(CYAN);
        rectangle(x+75, 255, x+125, 300);
        line(x+100, 255, x+100, 300);
        // car wheels
        setcolor(BLACK);
        circle(x+75, 315, 15);
        circle(x+175, 315, 15);
        // move the car
        x += 5;
        delay(50); // delay for animation
    }

    closegraph();
    return 0;
}