HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2017
0308
cmdマリオを作っているんですけど...1未解決


cmd

リンク

2017/3/8(Wed) 21:46:46|NO.78452

マリオを使っているんですけどスクロールができません。
どうすればスクロールができるのでしょうか?
あと、地面に落ちる判定も付けてほしいです。
回答は明日コメントします。

#include "hgimg3.as" #module #deffunc imgload str imgname, int imgbuffer buffer imgbuffer : picload "img\\"+imgname return #deffunc stagesave int world, str stagename notesave "stage\\world"+world+"\\"+stagename+".stg" return #deffunc stageload int world, str stagename exist "stage\\world"+world+"\\"+stagename+".stg" if strsize != -1{ noteload "stage\\world"+world+"\\"+stagename+".stg" } return #global notesel map map+" \n" map+" \n" map+" \n" map+" \n" map+" \n" map+" \n" map+" \n" map+" \n" map+" \n" map+" \n" map+" \n" map+" \n" map+" \n" map+" \n" map+"0000000000220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n" imgload "player.bmp",1 imgload "brk.png",2 gsel 0 dmmini dmmload "se\\die.wav",1 dmmload "se\\jump.wav",2 screen 0,640,480,0,ginfo(20)/2-320,ginfo(21)/2-300 zanki = 3 *main x = 32 : y = 32 * 13 : p1 = 0 repeat color 0,128,255 : boxf noteget gyou,(y+32)/32 masu=strmid(gyou,(x+16)/32,1) gosub,*mapwrite gosub,*jiki redraw 1:await 25:redraw 0 loop *jiki color 255,255,255 gmode 4,0,0,255 : color 0,0,0 : pos x,y if p1 = 0 : gcopy 1,0,0,32,32 if p1 = 1 : gcopy 1,32,32,64,32 stick key,5 if key&1:{ noteget gyou,y/32 masu=strmid(gyou,(x+16-1)/32,1) if masu=" ":x-6 p1 = 1 } if key&4:{ noteget gyou,y/32 masu=strmid(gyou,(x+16+1)/32,1) if masu=" ":x+6 p1 = 0 } if x > 32*4 : x = 32*4 : bx = bx - 6 if bx >= 0 : bx = 0 if rakka<15:rakka+1 noteget gyou,(y+32)/32 masu=strmid(gyou,(x+16)/32,1) if masu="0":yuka=1:y=y/32*32:rakka=0:else:yuka=0 if yuka=0:y+rakka if key&16:if yuka=1:jump=20:dmmplay 2 if jump>0:{ noteget gyou,(y-32)/32 masu=strmid(gyou,(x+16)/32,1) if masu!" ":y=y/32*32:jump=1 jump-1 y-jump } if x<0:x=0 if y<0:y=0 if x>640:x=640 noteget gyou,y/32 masu=strmid(gyou,(x+16)/32,1) if masu="0":{ if (x+16)/32*32>x+16:x-1 if (x+16)/32*32<x+16:x+1 } if y >= 512 : goto *GameOver return *mapwrite repeat 15 noteget gyou,cnt takasa=cnt repeat 100 masu=strmid(gyou,cnt,1) color 255,255,0 pos bx+cnt*32,takasa*32 if masu="0": gcopy 2,224,0,256,32 if masu="1": gcopy 2,0,0,0,32 loop loop return *GameOver dmmplay 1 wait 300 redraw 0 color 0,0,0 : boxf zanki = zanki - 1 text = "×"+zanki font msGothic,fontsize gmode 4,0,0,255 : color 0,0,0 : pos ginfo_winx/2-(strlen(text)*(fontsize/2))/2-32,ginfo_winy/2-fontsize/2-4 : gcopy 1,0,0,32,32 pos ginfo_winx/2-(strlen(text)*(fontsize/2))/2 , ginfo_winy/2-fontsize/2 color 255,255,255 : mes ""+text redraw 1 wait 100 goto *main
これがソースコードです。



この記事に返信する


ぼぶ

リンク

2017/3/18(Sat) 05:14:00|NO.78575

僕が持ってる画面スクロールのサンプルです。

screen 0,1200,1200,0,,,400,400 /// 背景を描く color 128,128,128 repeat 30 y = cnt repeat 30 x = cnt if ((y\2) = 0){ color 128,128,128 boxf (x * 80) ,(y * 40),(x * 80) + 40,(y * 40) + 40 color 0,0,0 boxf (x * 80) + 40 ,(y * 40),(x * 80) + 80,(y * 40) + 40 } else { color 0,0,0 boxf (x * 80) ,(y * 40),(x * 80) + 40,(y * 40) + 40 color 128,128,128 boxf (x * 80) + 40 ,(y * 40),(x * 80) + 80,(y * 40) + 40 } loop loop /// 背景の描き終わり PosX = 400 //初期のスクロール左上横座標 (ginfo(8) と同等) PosY = 400 //初期のスクロール左上縦座標 (ginfo(9) と同等) groll PosX,PosY //初期のビュー座標変更 *main redraw 0 stick ki,15,1 //↓正しく解釈できなくなるので、変な書き方です。 if ((ki&1) ! 0)&(PosX > 0) : PosX-- : groll PosX,PosY if ((ki&2) ! 0)&(PosY > 0) : PosY-- : groll PosX,PosY if ((ki&4) ! 0)&(PosX < 800) : PosX++ : groll PosX,PosY if ((ki&8) ! 0)&(PosY < 800) : PosY++ : groll PosX,PosY PlayerX = PosX + 200 //プレイヤーの中央座標の更新 PlayerY = PosY + 200 // 〃 title "BGX : "+ginfo(8)+" / BGY : "+ginfo(9)+" | PlayX : "+PlayerX+" / PlayY : "+PlayerY redraw 1 await 10 goto *main



ONION software Copyright 1997-2023(c) All rights reserved.