「ウソウォーリーを探せ」
DENZIさんが新しくペーパードールのアニメーション画像を作られたので、早速その素材を使ってショート・ゲームを作ってみました。
勢いで作ったので、スクリプトはめちゃんこ汚いです。一応コメントは入れていますが・・・
といっても、主にオリジナル画像からキャラクターを生成する部分を全てプログラムで計算させているからなんですが、画像ファイルを加工してプログラミングしやすい並びにすると、もう少しすっきりするかもしれません。
適当なフォルダに次のファイルを用意し、HSPでスクリプトを実行してみて下さい。
- common.hsp (ここからゲット)
- 16Retro_Wally.hsp (↓からゲット)これを実行
- Denzi091121-1.PNG (DENZI部屋さんのところからゲット) ※レトロ調ペーパードール(アニメーション)をbmp保存して下さい
うまく起動すると次のような画面でプレイできます。
拡大表示していないので、小さくてプレイしづらいかもです><
- SPACEキー でプレイ開始です。
- 画面には LEVEL の数だけキャラが表れます。
- これ!と思ったキャラを左クリックします。
- うまく探し当てるとLEVELアップします。
- LEVEL 100 達成すると、バグって終了します。
- 3回ハズレるとGAME OVER です。
スクリプトは、暇があれば、今後も改良していく予定です。
16Retro_Wally.hsp
; ; プログラム :「ウソウォーリーを探せ」を作ってみる ; ; 作成 :ふじぽん ; ; Copyright :http://d.hatena.ne.jp/fujiponXP ; ; 利用素材 : ; ; □ドット絵 :DENZI部屋(http://www3.wind.ne.jp/DENZI/diary/) ; タイトル :レトロ調ペーパードール(アニメーション) ; 更新日 :2009年11月22日 ; ファイル名:Denzi091121-1.PNG ※BMP形式で利用します。 ; ; 変更履歴 ; ver.1.0 2009/11/23 新規作成 ; ; ライセンスに関する表示 #include "common.hsp" about_lisence ; キャラモジュール #module m_RetroChar n, x, y, ho, pt, body, hair, head, wear_u, dwear_d, shoes, mantle, wepon, shield ; キャラ生成 #modinit array a n = a.0 x = a.1*16 y = a.2*16 body = a.3 hair = a.4 head = a.5 wear_u = a.6 wear_d = a.7 shoes = a.8 mantle = a.9 wepon = a.10 shield = a.11 gsel 2 ; body color 71, 108, 108: gmode 0,16,16,255 for h, 0, 4, 1 pos (h*4+0)*16, n*16: celput 1, body*4+95+h pos (h*4+1)*16, n*16: celput 1, body*4+95+45+h pos (h*4+2)*16, n*16: celput 1, body*4+95+45+45+h pos (h*4+3)*16, n*16: celput 1, body*4+95+45+h next ; wear_u if wear_u >=0 { color 71, 108, 108: gmode 4,16,16,255 for h, 0, 4, 1 pos (h*4+0)*16, n*16: celput 1, (wear_u\2)*4+(wear_u/2)*45*3+766+h pos (h*4+1)*16, n*16: celput 1, (wear_u\2)*4+(wear_u/2)*45*3+766+45+h pos (h*4+2)*16, n*16: celput 1, (wear_u\2)*4+(wear_u/2)*45*3+766+45+45+h pos (h*4+3)*16, n*16: celput 1, (wear_u\2)*4+(wear_u/2)*45*3+766+45+h next } ; wear_d if wear_d >= 0 { color 71, 108, 108: gmode 4,16,16,255 for h, 0, 4, 1 pos (h*4+0)*16, n*16: celput 1, (wear_d\2)*4+(wear_d/2)*45*3+774+h pos (h*4+1)*16, n*16: celput 1, (wear_d\2)*4+(wear_d/2)*45*3+774+45+h pos (h*4+2)*16, n*16: celput 1, (wear_d\2)*4+(wear_d/2)*45*3+774+45+45+h pos (h*4+3)*16, n*16: celput 1, (wear_d\2)*4+(wear_d/2)*45*3+774+45+h next } ; shoes if shoes >= 0 { color 71, 108, 108: gmode 4,16,16,255 for h, 0, 4, 1 pos (h*4+0)*16, n*16: celput 1, shoes*45*3+782+h pos (h*4+1)*16, n*16: celput 1, shoes*45*3+782+45+h pos (h*4+2)*16, n*16: celput 1, shoes*45*3+782+45+45+h pos (h*4+3)*16, n*16: celput 1, shoes*45*3+782+45+h next } ; mantle if mantle >= 0 { color 71, 108, 108: gmode 4,16,16,255 for h, 0, 4, 1 pos (h*4+0)*16, n*16: celput 1, mantle*45*3+786+h pos (h*4+1)*16, n*16: celput 1, mantle*45*3+786+45+h pos (h*4+2)*16, n*16: celput 1, mantle*45*3+786+45+45+h pos (h*4+3)*16, n*16: celput 1, mantle*45*3+786+45+h next } ; wepon if wepon >= 0 { color 71, 108, 108: gmode 4,16,16,255 for h, 0, 4, 1 pos (h*4+0)*16, n*16: celput 1, (wepon\2)*4+(wepon/2)*45*4+794+h pos (h*4+1)*16, n*16: celput 1, (wepon\2)*4+(wepon/2)*45*4+794+45+h pos (h*4+2)*16, n*16: celput 1, (wepon\2)*4+(wepon/2)*45*4+794+45+45+h pos (h*4+3)*16, n*16: celput 1, (wepon\2)*4+(wepon/2)*45*4+794+45+h next } ; shield if shield >= 0 { color 71, 108, 108: gmode 4,16,16,255 for h, 0, 4, 1 pos (h*4+0)*16, n*16: celput 1, shield*45*4+802+h pos (h*4+1)*16, n*16: celput 1, shield*45*4+802+45+h pos (h*4+2)*16, n*16: celput 1, shield*45*4+802+45+45+h pos (h*4+3)*16, n*16: celput 1, shield*45*4+802+45+h next } ; hair if hair >= 0 { color 71, 108, 108: gmode 4,16,16,255 for h, 0, 4*4, 1 pos h*16, n*16: celput 1, (hair\4)*4+(hair/4)*45+h/4+271 next } ; head if head >= 0 { color 71, 108, 108: gmode 4,16,16,255 for h, 0, 4*4, 1 pos h*16, n*16: celput 1, (head\3)*4+(head/3)*45+h/4+291 next } return ; 移動 #modfunc m_move gsel 0: color 71, 108, 108: gmode 4,16,16,255 if rnd(5)>0 : goto *skip if rnd(5)=0 : ho=rnd(4) x=limit(x+((ho=3)-(ho=1))*4, 0, 9*32-15) y=limit(y+((ho=0)-(ho=2))*4, 0, 9*32-15) pt=(pt+1)\4 *skip pos x, y: celput 2, n*16+ho*4+pt return ; 位置チェック #modcfunc findchk int px, int py ret=0 if abs(x-px)<16 & abs(y-py)<16 : ret=1 return ret #global ; メイン dim a,12 screen 0,9*32,9*32: title "ウソウォーリーを探せ" m_pload "Denzi091121-1.bmp" level=1 *start ; no x y body hair head wear_u wear_d shoes mantle wepon shield a = (level-1), rnd(18), rnd(18), rnd(9), rnd(41)-1, rhead(), rnd(21)-1, rnd(21)-1, rnd(11)-1, rnd(11)-1, rnd(15)-1, rnd(8)-1 newmod x, m_RetroChar, a *hitkey gsel 0: redraw 0: color 0,0,0: boxf color 255,255,255 pos 8*16, 5*16: mes "LEVEL "+level pos 5*16,14*16: mes "Hit [ SPACE ] Key!" m_display (level-1), 9*16,9*16 redraw 1 await 100 getkey key,32 if key=0 : goto *hitkey life=3 *main redraw 0: color 80,80,80: boxf stick key,256 if key & 256 { if findchk(x.(level-1), mousex, mousey) { dialog "当たり" level++ goto *start } else { life-- dialog "ハズレ 残り "+life+" 回" if life=0 : goto *gameover } } foreach (x) m_move x.cnt loop redraw 1 await 100 goto *main stop ; ゲームオーバー *gameover gsel 0: redraw 0: color 0,0,0: boxf color 255,255,255 pos 6*16, 7*16: mes "Game Over ..." pos 5*16,12*16: mes "You are LEVEL "+level redraw 1 wait 1000 end ; 画像読み込み #deffunc m_pload str fname celload fname, 1, 0 celdiv 1, 16, 16, 0, 0 buffer 2, 16*4*4, 16*100 ; 100キャラ分 celdiv 2, 16, 16, 0, 0 return ; 頭乱数 #defcfunc rhead *r_rhead r=rnd(30)-1 if r=5 or r=11 or r=17 or r=23 : goto *r_rhead return r ; ウォーリー表示(スタート時) #deffunc m_display int no, int px, int py pt=(pt+1)\4 gsel 0: color 71, 108, 108: gmode 4,16,16,255 pos px, py: celput 2, no*16+pt return