0

ヘルプ!プログラミング初心者です!モノポリーゲームを作ろうとしています。これまでの私のプログラムでは、プレイヤー オブジェクトとカード オブジェクトを作成しています。これらのオブジェクトにはいくつかの値が格納されています。

pygame を使用して何らかのアニメーションを実装し、pygame 画面にポップアップするメニュー バーを作成しようとしていますが、開始方法がわかりません。これまでのところ、私が持っているのはpygameの背景画面だけです。プレーヤーオブジェクトの位置の値に応じて、位置を指定してpygame画面に小さな長方形を配置する方法を知りたいです。ゲーム ロジック用に書いたすべてのコードをどのようにして取得し、この pygame のものと一緒に実行できるかを知る必要があります。

私は本当に始める方法を知る必要があります。私を正しい方向に導くために、誰かが私と一緒に時間を割いてくれるなら、本当に感謝しています。

4

1 に答える 1

1

いくつかのpygame チュートリアルを読むことは確かに役に立ちます。

プログラムの流れは、最終的に次のようになります。

# This is intentionally simplified pseudocode, but at the bottom-most level most
#    simple games have a similar structure to this.

#Construct your game objects
players = [Player(args) for n in range(num_players)]
cards = loadCards()   #or however you load your cards (files,database,etc)
board = Board()

#initialize your display context
pygame_screen.init()  #or whatever is the correct syntax for Pygame

# Main game loop
while 1:
    check_inputs()    #get key/mouse input inputs for this frame
    handle_inputs()    #handle each input that has occurred during this frame
    update_gamestate()    #update the state on the game (who's turn, etc)
    update_display()    #update pygame window graphics (draw stuff, flip display)

cleanup()

長方形の描画方法などの詳細については、ここでさまざまな描画関数について読む必要があります

于 2013-09-06T23:22:03.743 に答える