Discussions

Petit computer 3 Community

かい7102KAI

10/08/2017 4:35 AM ·Spoilers

Open Closed

質問です

ゲームで画面のスクロールをさせるにはどうプログラムしたらいいのですか。それと敵を踏むと倒せるようにプログラムするにはどうすればいいですか。

Advertisement

Comment

This post has no comments.

  • 簡単のため、マリオみたいな「右にだけスクロールするゲーム」で考えてみましょう~ マリオの「マップ上での」座標をX,Y、現在のマップの表示開始位置(表示範囲の左上の座標)をBX,BYとしてみます この時マリオの画面上での表示位置は、X,Yからマップの表示位置BX,BYを引いた座標になります んでんで、上画面の横幅は400ドットなので、XがBX+400を超えるとマリオが画面からはみ出ますよねー なのでそのとき、マリオが画面からはみ出さないようにマップの表示位置を変更してあげればOKです!プログラムにするとこんな感じです(*´▽`*) IF X>BX+400 THEN BX=X-400 BGOFS 背景のBG番号,BX,BY SPOFS マリオのSP番号,X-BX,Y-BY 400の部分を300とかにすると、右端まで行かなくてもスクロールします(*´▽`*)

    Yeahs0
    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-2NL9-UXY-EB2W

Report Violation to Miiverse Administrators

You cannot report posts made automatically by a software title.

Edit Post

Select an action: