« HSPTV!メルマガ 第43号 | メイン | 【講座】「教えて!おにたま!!」 »

2007年07月11日

【講座】HSPよく使うフレーズ 第33回 総集編1

長い連載やアニメでは、ネタが尽きて来ると総集編的なものを
やりますな。
このコーナーでも今回から総集編として、いままでの
スクリプトを集めてみました。

すべてHSP3用で、たいていの場合コピー&ペーストで動きます。
実際に試してみてください。

[1]プレゼントの抽選を行う

;抽選スクリプト
randomize
wait 100
a=rnd (75)+1
mes a
stop

[2]複数の拡張子を指定する

dialog "jpg;*.jpeg;*.bmp;*.gif",16,"画像ファイル"
if stat=0:stop
picload refstr,0
mes refstr
stop

[3]時刻を表示する

(1)時刻表示 画面に表示

*top
redraw 0 ;描画モード0
color 255,255,255:boxf ;全画面を描画
color 0,0,0:pos 0,0 ;カラー設定、座標設定
mes "Time is "+gettime(4)+":"+gettime(5)+":"+gettime(6)
redraw 1 ;描画モード1
await 50 ;ウェイト
goto *top

(2)時刻表示 タイトルバーを使う

*top
title "Time is "+gettime(4)+":"+gettime(5)+":"+gettime(6)
await 50 ;ウェイト
goto *top

[4]ゲームっぽいキー入力

screen 0,200,400
color 0,0,0:boxf
color 0,255,0
mx=5:my=18
*top
;キー入力
getkey key_left,37 ;<-
getkey key_right,39 ;->
;座標変化
if key_left:mx-=1
if key_right:mx+=1
;座標チェック
if mx<0:mx=mxx
if mx>11:mx=mxx
mxx=mx:myy=my
;画面再描画
color 0,0,0:boxf
color 0,255,0
pos mx*16,my*16
mes "▲"
wait 10
goto *top

[5]ゲームっぽいキー入力2 弾がでる

screen 0,200,400
color 0,0,0:boxf
color 0,255,0
mx=5:my=18
*top
;キー入力
getkey key_left,37 ;<-
getkey key_right,39 ;->
getkey key_space,32 ;space
;座標変化
if key_left:mx-=1
if key_right:mx+=1
;座標チェック
if mx<0:mx=mxx
if mx>11:mx=mxx
mxx=mx:myy=my
;弾移動
if tf {
ty-=1
if ty<0:tf=0
}
;弾
if key_space and tf=0 :gosub *tamamake
;画面再描画
color 0,0,0:boxf
color 0,255,0
pos mx*16,my*16
mes "▲"
if tf:pos tx*16,ty*16:mes "|"
wait 2
goto *top
*tamamake
tf=1:tx=mx:ty=my-1:return

(うすあじ)

投稿者 usuaji : 2007年07月11日 01:26

口臭チェッカー市場