2008年版から若干改良され、コンボ機能が付きました。連続してHANABIを取るとスコアアップ!高機能を目指したスリリングな展開を楽しめます。
/* HANABIGA @ やわらかライセンス by eller 2009/06/28
* ===============================================
* HANABIGAからの改造個所:
* コンボの導入
* SAKURAGAからの改造個所:
* "さくら" → "たまや" // "かぎや"でも良い
* キャラクタの移動動作変更(ちょい簡単に)
* 背景色など色合い変更
* ゲームオーバー中はキャラクタを生成しないように
* キャラクタ接触時にどかーん
* ゲームオーバー時にどかーん
* redraw 0 と redraw 1 を入れ替え
* randomize追加
* 640 → ginfo_winx など
*/
//#runtime "hsplet3"
#include "hspmath.as"
#packopt name "hanabiga"
#define FRAME_WAIT 16
#define PLAYER_SPEED 3.0
#define PLAYER_SP_REDUCE 0.8
#define CHAR_MAX 256
#define HANABI_MAX 8
#define CHAR_TYPE_NONE 0
#define CHAR_TYPE_SA 1
#define CHAR_TYPE_KU 2
#define CHAR_TYPE_RA 3
#define CHAR_FACE_SA "た"
#define CHAR_FACE_KU "ま"
#define CHAR_FACE_RA "や"
#define CHAR_FACE_HANABI "・"
#define HANABI_PARTS_NUM 14
#define CHAR_ROT_SP 0.05
#define CHAR_ROT_MOVE 0.8
#define CHAR_SIZE 16.0
#define COMBO_TIME_MAX 60
// 準備
; screen 0, 480, 320
title "HANABIGA 2009"
font "MS ゴシック" ,16,1
randomize
player_x = double(ginfo_winx / 2)
player_y = double(ginfo_winy / 2)
player_vx = 0.0
player_vy = 0.0
dim char_type,CHAR_MAX
ddim char_x,CHAR_MAX
ddim char_y,CHAR_MAX
ddim char_vx,CHAR_MAX
ddim char_vy,CHAR_MAX
dim char_timer,CHAR_MAX
ddim hanabi_x,HANABI_MAX
ddim hanabi_y,HANABI_MAX
dim hanabi_radius,HANABI_MAX
dim hanabi_life,HANABI_MAX
dim hanabi_life_max,HANABI_MAX
dim hanabi_r,HANABI_MAX
dim hanabi_g,HANABI_MAX
dim hanabi_b,HANABI_MAX
buffer 1,640,480
repeat 40
color cnt, 0, cnt * 2
boxf 0 , cnt * ginfo_winy / 40 , ginfo_winx , (cnt + 1) * ginfo_winy / 40
loop
gsel 0
gmode 3,,,64
// メイン処理
repeat
// INIT
gosub *initpl
// タイトル
repeat
redraw 0
gosub *clearscreen
gosub *movehanabi
gosub *movechar
gosub *collision
if(player_life > 0){
gosub *moveplayer
a = 10 - (player_score / 5) \ 10
if( a < 2 ) : a = 1
if(player_timer \ a == 0) : gosub *addchar
}else{
gosub *burstall
color 255, 255, 255
pos (ginfo_winx - 198)/ 2, (ginfo_winy - 16) / 2
mes "H A N A B I O W A T A"
stick inp
if(inp & 16) : break
}
gosub *showstatus
redraw 1
await FRAME_WAIT
loop
loop
*initpl
player_x = double(ginfo_winx / 2)
player_y = double(ginfo_winy / 2)
player_vx = 0.0
player_vy = 0.0
player_life = 1
player_chain_type = CHAR_TYPE_SA
player_score = 0
player_combo = 0
combo_time = 0
scroll_vx = 0.01
scroll_vy = -2.0
repeat CHAR_MAX
char_type(cnt) = CHAR_TYPE_NONE
loop
return
*clearscreen
pos 0,0
gcopy 1,0,0,ginfo_winx, ginfo_winy
return
*moveplayer
stick inp,255
if(inp & 1) : player_vx -= PLAYER_SPEED
if(inp & 2) : player_vy -= PLAYER_SPEED
if(inp & 4) : player_vx += PLAYER_SPEED
if(inp & 8) : player_vy += PLAYER_SPEED
player_timer++
player_vx *= PLAYER_SP_REDUCE
player_vy *= PLAYER_SP_REDUCE
player_x = limitf(player_x + player_vx, 0.0, ginfo_winx - CHAR_SIZE)
player_y = limitf(player_y + player_vy, 0.0, ginfo_winy - CHAR_SIZE)
color 255
pos player_x,player_y
if( player_chain_type == CHAR_TYPE_SA ){
mes CHAR_FACE_SA
} else : if( player_chain_type == CHAR_TYPE_KU ){
mes CHAR_FACE_KU
} else : if( player_chain_type == CHAR_TYPE_RA ){
mes CHAR_FACE_RA
}
if (combo_time > 0) : combo_time-- : else : player_combo = 0
return
*collision
repeat CHAR_MAX
if( char_type(cnt) == CHAR_TYPE_NONE ) : continue
dx = player_x - char_x(cnt)
dy = player_y - char_y(cnt)
if( abs(dx) < CHAR_SIZE & abs(dy) < CHAR_SIZE ) {
if( char_type(cnt) == player_chain_type ){
player_chain_type++
if(player_chain_type > CHAR_TYPE_RA){
player_chain_type = CHAR_TYPE_SA
}
if (combo_time > 0) {
player_combo++
}
player_score += 10 + player_combo
combo_time = COMBO_TIME_MAX
}else{
player_life--
}
char_type(cnt) == CHAR_TYPE_NONE
x = char_x(cnt)
y = char_y(cnt)
gosub *addhanabi
}
loop
return
*movechar
color 255,128
repeat CHAR_MAX
if( char_type(cnt) == CHAR_TYPE_NONE ) : continue
pos char_x(cnt) , char_y(cnt)
char_x(cnt) += char_vx(cnt)
char_y(cnt) += char_vy(cnt)
char_timer(cnt)++
char_x(cnt) += CHAR_ROT_MOVE * sin(double(CHAR_ROT_SP * char_timer(cnt)))
char_y(cnt) += CHAR_ROT_MOVE ;* cos(double(CHAR_ROT_SP * char_timer(cnt)))
if( char_y(cnt) < -16.0 ) : char_type(cnt) = CHAR_TYPE_NONE
if( char_type(cnt) == CHAR_TYPE_SA ){
mes CHAR_FACE_SA
} else : if( char_type(cnt) == CHAR_TYPE_KU ){
mes CHAR_FACE_KU
} else : if( char_type(cnt) == CHAR_TYPE_RA ){
mes CHAR_FACE_RA
}
loop
return
*addchar
repeat CHAR_MAX
if( char_type(cnt) != CHAR_TYPE_NONE ) : continue
char_type(cnt) = 1 + rnd(3)
char_x(cnt) = double(rnd(800) - 80)
char_y(cnt) = 20.0 + ginfo_winy
char_vx(cnt) = scroll_vx
char_vy(cnt) = scroll_vy
char_timer(cnt) = rnd(256)
break
loop
return
*showstatus
pos ginfo_winx - 160 , ginfo_winy - 40
color 255, 255, 255
mes strf("SCORE : %8d", player_score)
mes strf("COMBO : %8d", player_combo)
return
#const HANABI_CST 2.0 * M_PI / HANABI_PARTS_NUM
*movehanabi
repeat HANABI_MAX
if( hanabi_life(cnt) <= 0 ) : continue
hanabi_life(cnt)--
color hanabi_r(cnt), hanabi_g(cnt), hanabi_b(cnt)
; hanabi_y(up_cnt)++
up_cnt = cnt
r = cos(M_PI * hanabi_life(cnt) / hanabi_life_max(cnt) / 2.0) * hanabi_radius(cnt)
repeat HANABI_PARTS_NUM
pos hanabi_x(up_cnt) + cos(HANABI_CST * cnt) * r, hanabi_y(up_cnt) + sin(HANABI_CST * cnt) * r
mes CHAR_FACE_HANABI
loop
loop
return
*addhanabi
result = 0
repeat HANABI_MAX
if( hanabi_life(cnt) > 0 ) : continue
hanabi_x(cnt) = x
hanabi_y(cnt) = y
size = 10 + rnd(12)
hanabi_life_max(cnt) = size
hanabi_life(cnt) = size
hanabi_radius(cnt) = size * 3
hsvcolor rnd(192), 255, 255
hanabi_r(cnt) = ginfo_r
hanabi_g(cnt) = ginfo_g
hanabi_b(cnt) = ginfo_b
result = 1
break
loop
return result
*burstall
repeat CHAR_MAX
if( char_type(cnt) = CHAR_TYPE_NONE ) : continue
x = char_x(cnt)
y = char_y(cnt)
gosub *addhanabi
if stat : char_type(cnt) = CHAR_TYPE_NONE
loop
return