CoRサンプル集: ナンジャコーリャ
フリーで作った放置ゲームを移植してみました
セーブ機能が不安定
ロードに少し時間がかかります
セーブ機能が不安定
ロードに少し時間がかかります
プレー:78
(人数:14)
クリア:0
評価: 10 (1回)
scene 'start' do
title = nil
btan = []
Ply = []
Tgt = []
VSPic = nil
Zan = nil
Icon = []
Text = []
Tt_BGM=nil
OK_Snd = nil
Zn_Snd = nil
Mt_Snd = nil
Dn_Snd = nil
LU_Snd = nil
DD_Snd = nil
GMod = 0
Stp = false
ms_x = nil
ms_y = nil
CT = 0
Mod = 1
Zx = 400
FTS = 0
ZCT = 0
SCT = 0
DCT = 0
MT = nil
i = nil
V = nil
Ivt = []
Ptr = 0
PtN = 0
Bos = 0
TgS = 0
Lv = []
HPmx = []
HP = []
Fit = []
Exp = []
NxExp = 0
Amr = 0
TgLv = []
TgHP = []
TgFit = []
Sav1 = []
Sav2 = []
Sav3 = []
Sav4 = []
Sav5 = []
Sav6 = []
key1="data1"
key2="data2"
key3="data3"
key4="data4"
key5="data5"
key6="data6"
key7="data7"
key8="data8"
Amr=0
i=0
while i<50
HPmx[i]=100 + 50 * i
HP[i]=HPmx[i]
Lv[i]=1
Exp[i]=0
Fit[i]=10
Ivt[i]=0
TgLv[i]=1
TgHP[i]=TgLv[i]*50
TgFit[i]=TgLv[i]*5
Amr=Amr+Lv[i]
#key1[i]="data1"
#key2[i]="data2"
#key3[i]="data3"
#key4[i]="data4"
#key5[i]="data5"
#key6[i]="data6"
Sav1[i]="D"
Sav2[i]="D"
Sav3[i]="D"
Sav4[i]="D"
Sav5[i]="D"
Sav6[i]="D"
i = i + 1
end
Amr=Amr-50
if Amr<0
Amr=0
end
preload do
#画像
image 'タイトル', id: 325378
image 'タイトルボタン集', id: 325449, frame_size: [160,50], frame_pattern: 4
image 'ディル0', id: 325385
image 'ゴブリン0', id: 325386
image 'VSPic', id: 325387
image '斬撃', id: 325388
image 'Icon', id: 325389, frame_size: [30, 30], frame_pattern: 10
image 'ボス1', id: 325400
#BGM
music 'タイトルBGM', id: 227702
#効果音
sound '決定', id: 325384
sound '斬音', id: 325390
sound '敵消滅', id: 325394
sound '転倒', id: 325397
sound 'LvUp', id: 325398
sound '階段', id: 325399
end
create do
Icon[0] = put_sprite '保存' do
position 0,570
frame_index 0
end
Icon[1] = put_sprite '再生' do
position 30,570
frame_index 1
end
Icon[2] = put_sprite '停止' do
position 60,570
frame_index 2
end
Icon[3] = put_sprite '上り' do
position 90,570
frame_index 3
end
Icon[4] = put_sprite '下り' do
position 120,570
frame_index 4
end
#===テキスト===#
Text[0] = put_text '自HP' do
#position 10, game_size_h-22
position 10, 410
text 'HP'
end
Text[1] = put_text '敵HP' do
#position 10, game_size_h-22
position 410, 410
text 'HP'
end
Text[2] = put_text '自Lv' do
position 10, 450
text 'Lv'
end
Text[3] = put_text '敵Lv' do
position 410, 450
text 'Lv'
end
Text[4] = put_text '必要経験値' do
position 10, 490
text '必要経験値'
end
#キャラ画像&その他
Ply[0] = put_sprite 'プレイヤー00' do
position 200, 200
frame_index 0
end
Tgt[0] = put_sprite 'ターゲット00' do
position 600, 200
frame_index 0
end
Tgt[100] = put_sprite 'Bos1' do
position 600, -400
frame_index 0
end
VSPic = put_sprite 'VS' do
position 340, 160
frame_index 0
end
Zan = put_sprite '斬' do
position 400,0
frame_index 0
end
# タイトルの配置
title = put_sprite 'タイトル0' do
position 0, 0
frame_index 0
end
btan[0] = put_sprite 'タイトルボタン集0' do
position 50, 500
frame_index 0
end
btan[1] = put_sprite 'タイトルボタン集0' do
position 320, 500
frame_index 1
end
btan[2] = put_sprite 'タイトルボタン集0' do
position 570, 500
frame_index 3
end
#BGM
Tt_BGM = add_music('タイトルBGM')
#===効果音===#
OK_Snd = add_sound('決定')
Zn_Snd = add_sound('斬音')
Mt_Snd = add_sound('敵消滅')
Dn_Snd = add_sound('転倒')
LU_Snd = add_sound('LvUp')
DD_Snd = add_sound('階段')
#BGM再生
#Tt_BGM.play
end
update do
# タイトル画面
if GMod == 0
if pointer.down? #&& Key_control_flag == true
if Stp == false
Stp = true
ms_x = pointer.x
ms_y = pointer.y
if (ms_x > 50 && ms_x < 210 && ms_y > 500 && ms_y < 550)
OK_Snd.play
#重要ポイント#
#Ply[0].scale 0.5, 0.5
title.position 0, -600
btan[0].position 50,-100
btan[1].position 320,-100
btan[2].position 570,-100
GMod = 1
elsif (ms_x > 320 && ms_x < 480 && ms_y > 500 && ms_y <550)
OK_Snd.play
Amr=0
l=0
#while l<5
data1 = loadGameData(key1)
data2 = loadGameData(key2)
data3 = loadGameData(key3)
data4 = loadGameData(key4)
data5 = loadGameData(key5)
data6 = loadGameData(key6)
data7 = loadGameData(key7)
data8 = loadGameData(key8)
debug_log "Data1: #{data1}"
debug_log "Data2: #{data2}"
debug_log "Data3: #{data3}"
debug_log "Data4: #{data4}"
debug_log "Data5: #{data5}"
debug_log "Data6: #{data6}"
debug_log "Data7: #{data7}"
debug_log "Data8: #{data8}"
StrAry1 = data1.split(",")
StrAry2 = data2.split(",")
StrAry3 = data3.split(",")
StrAry4 = data4.split(",")
StrAry5 = data5.split(",")
StrAry6 = data6.split(",")
Ptr = data7.to_i #.split(",")
PtN = data8.to_i #.split(",")
i=0
while i<50
Lv[i] = StrAry1[i].to_i
HPmx[i] = StrAry2[i].to_i
Fit[i] = StrAry3[i].to_i
Exp[i] = StrAry4[i].to_i
TgLv[i] = StrAry5[i].to_i
Ivt[i] = StrAry6[i].to_i
HP[i] = HPmx[i]
TgHP[i] = TgLv[i] * 50
TgFit[i] = TgLv[i] * 5
Amr=Amr+Lv[i]
#wait_time(2000)
i = i + 1
end
Amr=Amr-50
if Amr<0
Amr=0
end
#data7 = loadGameData(key7)
#data8 = loadGameData(key8)
#Ptr = data7.to_i
#PtN = data8.to_i
#Fit[Ptr]=500000
title.position 0, -600
btan[0].position 50,-100
btan[1].position 320,-100
btan[2].position 570,-100
GMod = 1
end
end
else
Stp = false
end
# ゲーム画面
elsif GMod == 1
if Mod == 1
CT = CT + 1
end
if ((CT % 50) == 0 || ZCT > 0) && SCT==0 && DCT==0 && Mod==1
if ZCT == 0
Zn_Snd.play
if FTS == 1
Zx=400
FTS=0
else
Zx=0
FTS=1
end
end
ZCT = ZCT + 1
Zan.position Zx, 0
if ZCT > 10
ZCT = 0
if Zx == 400
MT = (Fit[Ptr] / 5 + rand(Fit[Ptr]) + Amr) - (TgFit[Ptr] / 5 + rand(TgFit[Ptr]) + TgLv[Ptr])
if MT > 0
TgHP[Ptr]=TgHP[Ptr]-MT
if (TgHP[Ptr] < 1)
TgHP[Ptr] = 0
SCT = 1
Exp[Ptr] = Exp[Ptr] + TgLv[Ptr];
LvU = 0
NxExp = (Lv[Ptr] * (2 * 50 + (Lv[Ptr] - 1) * 10)) / 2
while (NxExp <= Exp[Ptr])
LvU = LvU + 1
Lv[Ptr] = Lv[Ptr] + 1
HPmx[Ptr] = HPmx[Ptr] + 10
Fit[Ptr] = Fit[Ptr] + 5
NxExp = (Lv[Ptr] * (2 * 50 + (Lv[Ptr] - 1) * 10)) / 2
HP[Ptr] = HPmx[Ptr];
end
if (LvU > 0)
LU_Snd.play
Amr = 0
i=0
while (i < 100)
Amr = Amr + Lv[i]
i=i+1
end
Amr = Amr - 100
if (Amr < 0)
Amr = 0
end
end
NxExp = (Lv[Ptr] * (2 * 50 + (Lv[Ptr] - 1) * 10)) / 2
Mt_Snd.play
end
end
elsif Zx == 0
MT = (TgFit[Ptr] / 5 + rand(TgFit[Ptr]) + TgLv[Ptr]) - (Fit[Ptr] / 5 + rand(Fit[Ptr]) + Amr)
if MT > 0
HP[Ptr] = HP[Ptr] - MT
if HP[Ptr] < 1
HP[Ptr] = 0
DCT = 1
Dn_Snd.play
end
end
end
end
else
Zan.position Zx, -400
end
#敵ダウン処理
if SCT > 0
SCT = SCT + 20
if Bos > 0
Tgt[100].position 600, SCT + 200
angle = Tgt[100].angle
Tgt[100].angle angle + 10
else
Tgt[0].position 600, SCT + 200
angle = Tgt[0].angle
Tgt[0].angle angle + 10
end
if SCT > 800
SCT = 0
Tgt[0].angle 0
if Bos > 0
Tgt[100].angle 0
Ivt[Ptr] = Ivt[Ptr] + 1
TgHP[Ptr] = TgLv[Ptr] * 50
Bos = 0
if (Ivt[Ptr] == 1)
# アクティビティフィードを流す
result = send_activity_feed("レベル:#{Lv[Ptr]}でクリア");
# 結果をデバッグログに出力する
# 公開したゲームでは見えません
debug_log(result ? "フィードを流した" : "フィードを流さなかった")
game_clear
end
# if (Ivt[2] == 2 && PtN == 2) { PtN = PtN + 1; };
# if (Ivt[3] == 3 && PtN == 3) { PtN = PtN + 1; };
# if (Ivt[4] == 4 && PtN == 4) { PtN = PtN + 1; };
#if (Ivt[0] == 5 && Ivt[2] == 5 && Ivt[3] == 5 && Ivt[4] == 5 && Ivt[5] == 5) { GMod = 2; PlaySoundMem(BGM1, DX_PLAYTYPE_LOOP); }; //エンディングへ
else
TgHP[Ptr] = TgLv[Ptr] * 50
Tgt[0].position 600,200
end
end
end
#自分ダウン処理
if DCT > 0
DCT = DCT + 20
Ply[0].position 200, DCT + 200
angle = Ply[0].angle
Ply[0].angle angle + 10
if DCT > 800
DCT = 0
Mod=2
Ply[0].angle 0
HP[Ptr] = HPmx[Ptr]
Ply[0].position 200,200
end
end
Text[0].text("HP:#{HP[Ptr]}")
Text[1].text("HP:#{TgHP[Ptr]}")
Text[2].text("Lv:#{Lv[Ptr]}")
Text[3].text("Lv:#{TgLv[Ptr]}")
NxExp = (Lv[Ptr] * (2 * 50 + (Lv[Ptr] - 1) * 10)) / 2
V=NxExp-Exp[Ptr]
Text[4].text("必要経験値:#{V}")
#アイコン操作
if pointer.down?
if Stp == false
Stp = true
ms_x = pointer.x
ms_y = pointer.y
if (ms_x > 0 && ms_x < 30 && ms_y > 570 && ms_y < 600 && Mod==2)
OK_Snd.play
Text[4].text("セーブ中・・・かなりお待ちください")
data1=""
data2=""
data3=""
data4=""
data5=""
data6=""
i=0
while i<50
Str1=data1+"#{Lv[i]}"
data1 = Str1+","
Str2=data2+"#{HPmx[i]}"
data2 = Str2+","
Str3=data3+"#{Fit[i]}"
data3 = Str3+","
Str4=data4+"#{Exp[i]}"
data4 = Str4+","
Str5=data5+"#{TgLv[i]}"
data5 = Str5+","
Str6=data6+"#{Ivt[i]}"
data6 = Str6+","
i=i+1
end
data7="#{Ptr}"
data8="#{PtN}"
saveGameData(key1, data1)
saveGameData(key2, data2)
saveGameData(key3, data3)
saveGameData(key4, data4)
saveGameData(key5, data5)
saveGameData(key6, data6)
saveGameData(key7, data7)
saveGameData(key8, data8)
debug_log "Data1: #{data1}"
debug_log "Data2: #{data2}"
debug_log "Data3: #{data3}"
debug_log "Data4: #{data4}"
debug_log "Data5: #{data5}"
debug_log "Data6: #{data6}"
debug_log "Data7: #{data7}"
debug_log "Data8: #{data8}"
#GMod = 1
elsif (ms_x > 30 && ms_x < 60 && ms_y > 570 && ms_y < 600 && Mod==2)
OK_Snd.play
Mod = 1
if (TgLv[Ptr]==10 && Ivt[Ptr]==0)
Bos=1
Tgt[100].position 600,200
Tgt[0].position 600,-400
TgHP[Ptr] = TgLv[Ptr] * 100
TgFit[Ptr] = TgLv[Ptr] * 5 + 10
else
TgHP[Ptr] = TgLv[Ptr] * 50
TgFit[Ptr] = TgLv[Ptr] * 5
end
elsif (ms_x > 60 && ms_x < 90 && ms_y > 570 && ms_y < 600 && Mod==1)
OK_Snd.play
Mod = 2
HP[Ptr]=HPmx[Ptr]
elsif (ms_x > 90 && ms_x < 120 && ms_y > 570 && ms_y < 600 && Mod==2 && TgLv[Ptr]<10)
DD_Snd.play
TgLv[Ptr]=TgLv[Ptr]+1
elsif (ms_x > 120 && ms_x < 150 && ms_y > 570 && ms_y < 600 && Mod==2 && TgLv[Ptr]>1)
DD_Snd.play
TgLv[Ptr]=TgLv[Ptr]-1
end
end
else
Stp = false
end
else
end
end
render do
end
end
start_scene 'start'
sprite 'タイトル0' do
image 'タイトル'
origin :left_top
end
sprite 'タイトルボタン集0' do
image 'タイトルボタン集'
origin :left_top
end
sprite 'プレイヤー00' do
image 'ディル0'
origin :center
end
sprite 'ターゲット00' do
image 'ゴブリン0'
origin :center
#animation 'Bos1', image 'ボス1', true
end
sprite 'Bos1' do
image 'ボス1'
origin :center
end
sprite 'VS' do
image 'VSPic'
origin :left_top
end
sprite '斬' do
image '斬撃'
origin :left_top
end
sprite '保存' do
image 'Icon'
origin :left_top
end
sprite '再生' do
image 'Icon'
origin :left_top
end
sprite '停止' do
image 'Icon'
origin :left_top
end
sprite '上り' do
image 'Icon'
origin :left_top
end
sprite '下り' do
image 'Icon'
origin :left_top
end
sprite '仲間' do
image 'Icon'
origin :left_top
end
#####テキストスプライト定義#####
text '自HP' do
origin :left_top #原点を画像左上に設定
font_size 30
color '#EEEEEE' #白っぽい色
end
text '敵HP' do
origin :left_top #原点を画像左上に設定
font_size 30
color '#EEEEEE' #白っぽい色
end
text '自Lv' do
origin :left_top #原点を画像左上に設定
font_size 30
color '#EEEEEE' #白っぽい色
end
text '敵Lv' do
origin :left_top #原点を画像左上に設定
font_size 30
color '#EEEEEE' #白っぽい色
end
text '必要経験値' do
origin :left_top #原点を画像左上に設定
font_size 30
color '#EEEEEE' #白っぽい色
end
コード一覧
- start.rb
プレー内容を公開する
プレー履歴
プレー履歴はありません。
新着レビュー
レビューはまだ投稿されていません。 作品の感想を作者に伝えるためにレビューを投稿してみませんか?
フォロー/シェア