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


HSPTV!掲示板


未解決 解決 停止 削除要請

2014
0623
tyaシューティングゲームについて1未解決


tya

リンク

2014/6/23(Mon) 06:29:15|NO.62575

シューティングゲームを製作しているのですが、
一面道中→ボス→二面道中→ボス・・・といったように、ステージ制にしたいです。
できればボスと戦う前にキャラを表示させてボスと会話している、といったストーリーも
入れたいのですが、どんな文をどこに入力させていいのかさっぱりです。
部分的にでもいいので教えていただけるとうれしいです。

今の段階では、一面(雑魚しかでてこない)のノルマ数を倒したら二面へ進む、
といった感じです


celload "dotcg_n.bmp",1
cxs=32 :cys=32
celdiv 1,cxs,cys

wxs=760 :wys=400
screen 0,wxs,wys

;BGM,効果音,FONT設定
font "Impact",16
se=1 :bg=1

*start
title "完成版HSPシューティング"
pos 0,0 :picload "title.bmp",1

stg=0
pnt=0
hp=10

objmode 1
pos wxs-48,wys-40
chkbox "SE",se
chkbox "BG",bg

gsel 0,1
gosub *pse

if se=0 {
repeat 4 :mmload "muon.wav",cnt :loop
} else {
mmload "shot.wav",0
mmload "hit.wav",1
mmload "bomb.wav",2
mmload "warp.wav",3
}

n=se :e=bg
clrobj
se=n :bg=e

;ステージごとに変更するBGM,背景読み込み
*nxtstg
gosub *clr
a=stg+1 :a="STAGE "+a
pos wxs/2-16,wys/2-16 :mes a
title a :wait 150

buffer 2
b=strf("%02d",bck) :a="n_back"+b+".bmp"
exist a :if strsize<0 :bck=0 :a="n_back00.bmp"
picload a

ssp=ginfo_winx-wxs :if ssp<0 :ssp=0

if bg=1 { b=strf("%02d",msc) :a="bgm"+b+".mid"
exist a :if strsize<0 :msc=0 :a="bgm00.mid"
mmload a,4,1 :mmplay 4
}

gsel 0

; --- 自機の初期設定(配置) --- 同時に発射できる最大発射数、座標

px=64 :py=wys/2-16
tmx=hp/4+2 :if tmx<3 :tmx=3

dim tf,tmx
dim tx,tmx :dim ty,tmx

repeat tmx :tf(cnt)=0 :loop

; --- 敵の初期設定(配置) --- 1ステージで追撃すべきノルマ

emx=(stg+2)/2
ecn=(stg\2+2)*emx

dim ehp,emx
dim ex,emx :dim ey,emx
dim dx,emx :dim dy,emx

randomize

repeat emx :ehp(cnt)=0 :loop

etmx=ecn

dim etf,etmx
dim etx,etmx :dim ety,etmx
dim tdx,etmx :dim tdy,etmx

repeat etmx :etf(cnt)=0 :loop

; --- メインプログラム --- 時機操作、敵を倒す作業ループ

*main

redraw 2

gmode 1
scr=(scr+ssp)\wxs
pos 0,0 :gcopy 2,scr,0,wxs-scr,wys
if scr!0 :pos wxs-scr,0 :gcopy 2,0,0,scr,wys

gmode 2

stick ky,15
if ky&1 :px-=8 :if px<8 :px=8
if ky&4 :px+=8 :if px>(wxs/2-cxs) :px=wxs/2-cxs
if ky&2 :py-=8 :if py<8 :py=8
if ky&8 :py+=8 :if py>(wys-cys-8) :py=wys-cys-8

if hp>0 :pos px,py :celput 1,0

repeat tmx
if tf(cnt)=0 {
if ky&16 { tx(cnt)=px+28 :ty(cnt)=py+4
tf(cnt)=1 :ky=0 :mmplay 0
}
}
else { tx(cnt)+=16 :if tx(cnt)>(wxs-8) :tf(cnt)=0
}

if tf(cnt)=1 :n=cnt :gosub *hitchk

if tf(cnt)=1 :pos tx(cnt),ty(cnt) :celput 1,2
loop

e=0 :repeat emx :e+=(ehp(cnt)>0) :loop

repeat emx
r=rnd(30)
if ehp(cnt)>0 {
if r<3 :r=rnd(5) :dx(cnt)=(r-2)*4 :r=rnd(5) :dy(cnt)=(r-2)*4
x=ex(cnt) :ex(cnt)+=dx(cnt)
if (ex(cnt)<(wxs/2))|(ex(cnt)>(wxs-cxs)) :ex(cnt)=x :dx(cnt)=-dx.cnt
y=ey(cnt) :ey(cnt)+=dy(cnt)
if (ey(cnt)<8)|(ey(cnt)>(wys-cys-8)) :ey(cnt)=y :dy(cnt)=-dy(cnt)

pos ex(cnt),ey(cnt) :celput 1,1
}
else {
if (r+wap=0)&(ecn>e) {
wpx=(wxs/2)+rnd(wxs/2-cxs) :wpy=rnd(wys-cys)
wap=10 :wen=cnt :mmplay 3
}
}
loop

r=rnd(etmx) :e=rnd(emx)
if (etf(r)=0)&(ehp(e)>0) { ety(r)=ey(e) :etx(r)=ex(e)-24
x=rnd(2) :tdx(r)=(x+1)*8 :y=rnd(5) :tdy(r)=(y-2)*4
etf(r)=1
}

repeat etmx
x=etx(cnt) :y=ety(cnt)
if (etf(cnt)=1)&(px+cxs>x)&(x+(cxs/2)>px)&(py+cys>y)&(y+(cys/2)>py) {
etf(cnt)=0 :htc=4 :hx=etx(cnt) :hy=ety(cnt) :mmplay 1
hp- :if hp<1 :bmc=4 :bmx=px :bmy=py :mmplay 2
}

if etf(cnt)=1 { pos etx(cnt),ety(cnt) :celput 1,3
etx(cnt)-=tdx(cnt) :ety(cnt)+=tdy(cnt)
if (etx(cnt)<0)|(ety(cnt)<-16)|(ety(cnt)>(wxs-16)) :etf(cnt)=0
}
loop

if wap>0 { wap- :fva=(10.0-wap)/10
pos wpx,wpy :celput 1,1,fva,fva,57.3*wap
if wap=0 :ehp(wen)=3 :ex(wen)=wpx :ey(wen)=wpy :dx(wen)=0 :dy(wen)=0
}

if htc>0 :htc- :pos hx,hy :celput 1,4+htc

if bmc>0 :bmc- :pos bmx,bmy :celput 1,8+bmc

color 255,255,255
a=strf("%03d",ecn) :b=strf("%05d",pnt) :c=strf("%02d",hp)
pos 4,4 :mes "N:"+a
pos wxs-64,4 :mes "G:"+b
pos 4,wys-24 :mes "H:"+c

redraw 1

wait 5

if (ecn>0)&(hp>0) :goto *main

if bmc>0 :goto *main

if bg=1 :mmstop

if hp>0 { hp=hp/3+hp+(hp<3) :if hp>30 :hp=30
stg=(stg+1)\100 :bck+ :msc+ :goto *nxtstg
}


pos wxs/2-40,wys/2-16 :mes "GAME OVER"
wait 100 :gosub *pse

sdim txbf,64 :dim pt,6
exist "best5.cnt" : if strsize>0 : bload "best5.cnt",txbf
notesel txbf : n=pnt :i=0
repeat 5 :noteget e,cnt :e=int(e)
if pnt>e :pt(i)=pnt :pnt=-1 :n=cnt :i+
pt(i)=e :i+
loop

gosub *clr

a="HIGH SCORE" :title a :pos wxs/2-40,wys/2-80 :mes a
repeat 5
e=pt(cnt) :e=strf("%05d",e) :color 200,200,200
if (pnt<0)&(n=cnt) :color 255,255,255
i=1+cnt :y=16*cnt+(wys/2-48)
pos wxs/2-32,y :mes ""+i+"."
pos wxs/2-16,y :mes e
noteadd e,cnt,1
loop
bsave "best5.cnt",txbf,35

wait 100 :gosub *pse
goto *start



*hitchk
repeat emx
x=ex(cnt) :y=ey(cnt)
if (ehp(cnt)>0)&(x+cxs>tx(n))&(tx(n)+(cxs/2)>x)&(y+cys>ty(n))&(ty(n)+(cys/2)>y) {
tf(n)=0 :htc=4 :hx=tx(n) :hy=ty(n) :pnt+ :mmplay 1 :ehp(cnt)-
if ehp(cnt)<1 :ecn- :bmc=4 :bmx=ex(cnt) :bmy=ey(cnt) :pnt+=7 :mmplay 2
}
loop
return

*clr
color 0,0,0 :boxf 0,0,wxs,wys
color 255,255,255 :return

*pse
wait 1 :stick ky,0 :if ky!16 :goto *pse
return



この記事に返信する


kino

リンク

2014/6/23(Mon) 08:33:06|NO.62577

分かりやすい方法としてはscene_flgとかの変数を使うやり方がありますね

repeat
自機の処理、点数表示等
if scene_flg=0 { 1面雑魚の処理 、ノルマクリアーでscene_flg=1}
if scene_flg=1 { 会話の処理、会話終了でscene_flg=2}
if scene_flg=2 { ボスの処理 }
loop

処理を使いまわしたい場合は
if (scene_flg=0 or scene_flg=3) {雑魚の処理、ノルマクリアーで scene_flg+1}
とかですかね^^



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