前回の記事でキャラクターを画面に出しました。今回はキャラクターを動かしてみたいと思います。 左右キーでキャラクターを動かし、スペースでジャンプ。 コード これが今回作成したコード。 import pygame import sys # 定数の設定 SCREEN_WIDTH = 800 SCREEN_HEIGHT = 600 ...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
今回はちょっと実用処理から離れてPythonでゲームを作ってみよう。Pythonにはさまざまなライブラリが用意されており、その中にはゲーム開発に特化したライブラリもある。今回はPyGameと呼ばれるライブラリの使い方を紹介する。PyGameで迷路ゲームを作って ...
自分が押したキーが「K_ENTER」なのか「K_RETURN」なのか、分からない!! と苦戦したのでメモを残します。 また、「Pygame」では反応してくれないキーも一部調べられます。 自分が押したキーが「K_??」のどれに該当するのか分かれば、あとはif event.key ...
Python is well known as one of the most beginner-friendly and flexible programming languages. But while Python has a fantastic onboarding experience for even the least experienced new programmers, it ...
一部の結果でアクセス不可の可能性があるため、非表示になっています。
アクセス不可の結果を表示する