2017-05-29 6 views
2

私は、レンピを使わずにパイソン/パイゲームでビジュアル小説を作る方法を学ぶ方法を見つけようとしています。私はpygameで書いたゲームをいくつか持っており、その視覚的な部分を一つの大きなシングルゲームでのゲームの変遷として使いたいと思っています。私はここに来る前に、パイゲームでレンピーを使わずに視覚的に斬新なタイプのゲームを作る方法がない理由を混乱させる前に、たくさんのことを探しました。レンピーではないパイガムの視覚小説を作成する

コードを書き留めましたが、行とその次を表示する場合、同じコードを約40回繰り返す必要があります。どのようにしてコードを圧縮し、プレーヤーが次のテキストセットに実際にクリックするのを(サンプルのように3秒間待つのではなく)許可することができますか?

関連するサンプルコード:私と一緒に貼り付ける

def two(): 
    screen.blit(bg,bg_rect) 
    draw_text(screen, "C:", 26, width/3, 426) 
    draw_text(screen, "R, it's this.", 22, width/2, 466) 
    pg.display.flip() 
    time.sleep(3) 
    for event in pg.event.get(): 
     if event.type == pg.QUIT: 
      pg.QUIT() 

def one(): 
    screen.blit(bg, bg_rect) 
    draw_text(screen, "R:", 26, width/3, 426) 
    draw_text(screen, "C, don't think.", 22, width/2, 466) 
    pg.display.flip() 
    time.sleep(3) 
    for event in pg.event.get(): 
     if event.type == pg.QUIT: 
      pg.QUIT() 
     else: 
      two() 

running = True 
game_over = True 
while running: 
    if game_over: 
     show_menu() 
     one() 
     two() 

おかげで; - ;

答えて

0
screenOne = { 
    "text": "Do you want to hangout?", 
    "options": ["Yes", "No", "Are you sure?"] 
    } 

screenTwo = { 
    "text": "Are you ok?", 
    "options": ["I feel ok...", "No", "Feed me senpai..."] 
    } 

def draw_stuff(currentScreen): 
    renderText(currentScreen["text"]) 
    for option in currentScreen["options"]: 
     renderText(option) 


currentScreen = screenOne 
while (gameRunning): 
    draw_stuff(currentScreen) 

pygame lingoを使用せずに、私はあなたがそれを得ると思います。

EDIT ONE

mousePos = getMousePos() 
optionButtons = [1, 2, 3] 

for b in optionButtons: 
    if mousePos.x == optionButtons.x and mousePos.y == optionButtons.y: 
     getEvent(b) 

は再びこれは、本質的に疑似コードであるが、それは役立つはずです。

+0

あなたは何をしているのですか?それでも、そのコードの "currentScreen = screenone"に基づいて何か40時間をコード化する必要はありませんか? –

+0

あなたは、画面ごとに複数の辞書を作成し、画面が完了したらリセットする必要があります –

+1

私は今それがthxになったと思います。 030私はvn rn上で他の2人のパートナーと協力しています。私はまだコーディングについては知らないので、コーディングにもっと慣れるまで待つと思います。 thx tho 0v0 –

関連する問題