---
# System prepended metadata

title: Untitled

---

小恐龍

增加遊戲開頭
```
void welcome_screen()
{
    char choice;
    printf("Welcome to Dino Game!\n");
    printf("Do you want to start the game? (y)");
    scanf(" %c", &choice);
    if (choice != 'y' && choice != 'Y')
    {
        exit(0);
    }
}
```  
![](https://i.imgur.com/5n1Uu4V.png)

無敵星星
```
bool spawn_star(Dino* MyDino)
{
    int random_number = rand() % 200;
    if (random_number < MyDino->put_super_star)
        return true;
    return false;
}
```
減少無敵星星的時間 跟 吃到星星加分
```
if (MyDino->super_time > 0)
{
    MyDino->super_time -= 1;
}        
if (is_star_bumped(MyDino))
{
    MyDino->score += 50;
    MyDino->put_super_star += 1;
    MyDino->super_time = 10;
}
```
幫恐龍做超人造型順便在頁面顯示分數跟無敵時間
```
void display(Dino* MyDino)
{
    system("cls");
    printf("\n\n\t");
    for (int i = 0; i < ROAD_LENGTH; i++)
    {
        if (i == DINO_PLACE && MyDino->jump_time_left > 0){ 
            printf("__O.O\n"
                "                 `/`\n" 
                "                 _ _\n");
        }
        else if (i == DINO_PLACE && MyDino->jump_time_left == 0){
            printf("O.O\n"
                   "            ~~`|'\n"
                   "              / \\");
        }
        else{
            printf(" ");
        }
    }
    printf("\n\t");   
    for (int i = 0; i < ROAD_LENGTH; i++)
    {
        printf("%c", MyDino->road[i]);
    }
    printf("\n\n\n\t");
    printf("\t\tyour score is : %d\n", MyDino->score);
    printf("\t\t\tSuper Time : %d\n", MyDino->super_time);
}
```
看這栩栩如生的超人
![](https://i.imgur.com/9rBANen.png)

bug!
1.改造型後小恐龍會飛起來
2.螢幕頻閃
3.跑大約一萬分後地上會都變無敵星星
4.跳起來的時候有時會地板會上升

![](https://i.imgur.com/VONHyq1.gif)
執行畫面

![](https://i.imgur.com/kEwnPu2.gif)
動感舞步