Discussions

Petit computer 3 Community

レーシポンEstalLv50

10/15/2017 2:22 AM ·Spoilers

Open Closed

BUTTON()命令

プチコン初心者です。 BUTTON()←この中に、十字の↑なら1、Aだったら16を入れる事は覚えたのですが、それをどう実行するかが分かりません。 ボタンが押されている時に、変数にそれが入ると言うのもよく分かりません…。 プチコンの講座を読んでもよくわからないので、教えて下さい! 答えてくれた方にはフォローします!

Advertisement

Comment

This post has no comments.

  • ボタン命令って、最初分かりづらいですよね…。(私もそうでした…。) BUTTON の後の ( ) には、押された状態を表す数字が入ります!(それはヘルプで見られます。) 例えば、押されたら反応するという場合は、BUTTON(2) となります。 押されたボタンの種類は、BUTTON(2)==#A などの形式で入力します! 1,8,16…などの数字でも良いのですけど、#A などのほうが簡単です♪ 実際に使うには、IF BUTTON(2)==#A THEN ~のような形式にします。

    Yeahs2
    Played
  • >変数にそれが入ると言うのもよく分かりません< B%=5というように変数に数値を代入しますよね? それと同じように B%=BUTTON(2) とすればその行が実行されたときに押されたときのボタンの情報が変数に入ります。良く分からないなら変数に代入しないでも使えますよ。 ボタンの使い方 基本はIF文とセットで使います。 例えばループ中に IF (BUTTON(2) AND 16)==16 THEN BEEP 50 ENDIF と書けば「Aボタンが押されたときに音をならす」という意味になります。

    Yeahs2
    Played
  • 2人とも、ありがとうございました! もしも~なら~の文と一緒に使うのですね! いろいろ試してみて、マスターしたいと思います!! 本当にありがとうございました!!

    Yeahs1
    Played

Add a Comment

You must sign in to post a comment.

Sign in using a Nintendo Network ID to connect to users around the world by writing posts and comments and by giving Yeahs to other people's posts. You can create a Nintendo Network ID using your Wii U console or your system in the Nintendo 3DS family.

Use of Miiverse Details about Miiverse

Report Violation to Miiverse Administrators

You are about to report a post with content which violates the Miiverse Code of Conduct. This report will be sent to Nintendo's Miiverse administrators and not to the creator of the post.

Violation Type:

Post ID: 3DB-NBL7-DPU-2NLA-ARF-CV3R

Report Violation to Miiverse Administrators

You cannot report posts made automatically by a software title.

Edit Post

Select an action: