初めて横スクロールアクションゲームを作った件
投稿者:
光楼(114)
投稿日:2015/07/19 17:31
まだ実験段階ですが、こちら。
横スクアクション実験ゲーム - 【ノベルゲーム】
ちなみにこれがスクリプトです。
全部開始スクリプトに書いてます。
もうすこし完成形に近づけたいなぁー。
ツイート
横スクアクション実験ゲーム - 【ノベルゲーム】
ちなみにこれがスクリプトです。
#□□□□□□□□□□□
#□JUMP&DASH□
#□□□□□□□□□□□
#_/_/_/_/_/_/_/_/システム設定_/_/_/_/_/_/_/_/
#メニュー項目等の表示OFF
setMenuItemVisible(getMenuBackLog(), false)
setMenuItemVisible(getMenuSave(), false)
setMenuItemVisible(getMenuLoad(), false)
setHelpVisible(false)
setMenuOpenKeyEnable(false)
#デバッグ設定
setFlag("デバッグ", false)
#_/_/_/_/_/_/_/_/関数設定_/_/_/_/_/_/_/_/
def Array(a) #配列設定用
a = splitString(a, ",")
i = 0
while i < getArrayLength(a)
a[i] = toNumber(a[i])
i = i + 1
end
return a
end
def enc(d, h) #マップ数値データをアルファベットに変換
Mapd = splitString(d, "")
i = 0; n = 0 #n チップID
ms = ""; txt = "" #ms 文字列のチップID
Al = splitString("ABCDEFGHIJKLMNOPQRSTUVWXYZ", ""); al = splitString("abcdefghijklmnopqrstuvwxyz","")
while i < getArrayLength(Mapd)
if (Mapd[i] != " ") && (Mapd[i] != ",") && (Mapd[i] != "\n")
ms = ms + Mapd[i]
elsif Mapd[i] == "\n"
txt = txt + "\n"
elsif Mapd[i] == ","
n = toNumber(ms)
txt = txt + Al[n % h] + al[floor(n / h)]
ms = ""
end
i = i + 1
end
if getFlag("デバッグ") then speakFullScreen(false, txt + "\n"); end
return txt
end
def MapSet(d) #マップ設定
MapArf = splitString(d, "")
setVariable("マップデータ",createArray()) #文字列
getVariable("マップデータ")[0] = createArray()
setVariable("マップ高", 0); setVariable("マップ長", 0)
di = 0; dd = 0 #代入用 iは横 dは縦
i = 0
d = "" #代入用文字
A = ""
f = true
while f
A = MapArf[i]
if A >= "A" && A <= "O"
d = A
elsif A >= "a" && A <= "z"
getVariable("マップデータ")[dd][di] = d + A
di = di + 1
elsif A == "\n"
if getVariable("マップ長") < di
setVariable("マップ長", di)
end
dd = dd + 1; di = 0
getVariable("マップデータ")[dd] = createArray()
elsif getArrayLength(MapArf) <= i
setVariable("マップ高", dd)
f = false
end
i = i + 1
end
end
def BGprint(name,nan,x,y,z) #マップ表示
mx = 0; my = 0
hd = splitString(nan, "")
case hd[0]
when "A"
my = 0
when "B"
my = 1
when "C"
my = 2
when "D"
my = 3
when "E"
my = 4
when "F"
my = 5
when "G"
my = 6
when "H"
my = 7
when "I"
my = 8
when "J"
my = 9
when "K"
my = 10
when "L"
my = 11
when "M"
my = 12
when "N"
my = 13
when "O"
my = 14
end
my = my * 32
case hd[1]
when "a"
mx = 0
when "b"
mx = 1
when "c"
mx = 2
when "d"
mx = 3
when "e"
mx = 4
when "f"
mx = 5
when "g"
mx = 6
when "h"
mx = 7
when "i"
mx = 8
when "j"
mx = 9
when "k"
mx = 10
when "l"
mx = 11
when "m"
mx = 12
when "n"
mx = 13
when "o"
mx = 14
when "p"
mx = 15
when "q"
mx = 16
when "r"
mx = 17
when "s"
mx = 18
when "t"
mx = 19
end
mx = mx * 32
setSpriteRect(name, mx, my, 32, 32, x, y, getVariable("ブロックサイズ"), getVariable("ブロックサイズ"))
setSpriteZOrder(name, z)
end
def ZT(a) #絶対値
if a < 0 then a * (-1); end
return a
end
#_/_/_/_/_/_/_/_/データ設定_/_/_/_/_/_/_/_/
LVL = 0 #ゲーム難易度
ENMkind = 1 #敵の種類の数
setVariable("ブロックサイズ", 50) #ブロックサイズ
#Zオーダー
plZ = 10 #プレーヤー
mobZ = 8 #MOB
mapZ = 5 #マップ
bgZ = 0 #背景
#素材ID
CHARASPid = createArray() #画像ID
CHARASPid[0] = 182700 #背景画像ID
CHARASPid[1] = 79094 #マップ画像ID
CHARASPid[2] = 87833
CHARASPid[3] = null
BGMid = 8803 #音楽ID
SNDid = createArray() #効果音
SNDid[0] = 86807 #スタート
SNDid[1] = 110762 #ジャンプ
SNDid[2] = null #ダメージ
SNDid[3] = 161632 #ゴール
SNDid[4] = 143612 #ゲームオーバー
SNDid[5] = null #アイテム取得
#アニメ数
ani_kind = createArray()
#プレーヤーアニメーションデータ
ani_kind[0] = Array("2,4,1,1,1")
MYanm = createArray()
i = 0
while i < 40
MYanm[i] = createArray()
i = i + 1
end
#_/_/順行_/_/
#停止時
#x,y,w,h
MYanm[0] = Array("0,96,96,96"); MYanm[1] = Array("96,96,96,96")
#移動時
MYanm[4] = Array("192,96,96,96"); MYanm[5] = Array("288,96,96,96"); MYanm[6] = Array("384,96,96,96"); MYanm[7] = Array("480,96,96,96")
#ジャンプ時
MYanm[8] = Array("576,96,96,96")
#降下時
MYanm[12] = Array("672,96,96,96")
#ダメージ受けた時
MYanm[16] = Array("864,96,96,96")
#_/_/逆行_/_/
#停止時
MYanm[20] = Array("0,0,96,96"); MYanm[21] = Array("96,0,96,96")
#移動時
MYanm[24] = Array("192,0,96,96"); MYanm[25] = Array("288,0,96,96"); MYanm[26] = Array("384,0,96,96"); MYanm[27] = Array("480,0,96,96")
#ジャンプ時
MYanm[28] = Array("576,0,96,96")
#降下時
MYanm[32] = Array("672,0,96,96")
#ダメージ受けた時
MYanm[36] = Array("864,0,96,96")
#モブAアニメーションデータ
ani_kind[1] = Array("2,4,1,1,1")
MOBAanm = createArray()
#_/_/_/_/_/_/_/_/タイトル_/_/_/_/_/_/_/_/
stg = speakWithSelect(3,"ステージ1","ステージ2","ステージ3","どのステージで遊びますか?")
#_/_/_/_/_/_/_/_/帰還用ループ_/_/_/_/_/_/_/_/
while 1
#_/_/_/_/_/_/_/_/初期設定_/_/_/_/_/_/_/_/
#キャンバスの初期化
setCanvasVisible(false)
deleteAllSprite()
drawCanvas()
setCanvasVisible(true)
setSpriteCameraOffset(0, 0)
setSpriteCameraRotation(0)
setSpriteCameraScale(1.0, 1.0)
if getFlag("デバッグ")
LVL = LVL + 10 #ゲーム難易度
else
LVL = LVL + 1 #ゲーム難易度
end
OVA = false #ゲーム終わるか
insky = true #空中にいるか
time = 0 #ループ回数設定
FT = 0; FS = 0; FJ = 0 #移動の力
X = 0; Y = 0; X1 = 0; Y1 = 0
xi = 0; yi = 0
SFX = 0 #0計算しない 1加算 2減算
SFY = 0
m = 0 #0通常 1クリア 2ゲームオーバー
k = 0 #ゴールタイム
#キー初期化
keyFlag = Array("0,0,0")
#カメラ位置
CameraX = 0; CameraY = 0;
#テキスト管理
deleteTextAll()
textID = createText(10, 34, 520, 420) #デバッグ
txt1 = createText(800 / 2 - 65, 600 / 2 - 100, 300, 100)
#キャラステータス管理 0番目はプレーヤー
chara_st = createArray()
case stg
when 0
chara_st[0] = Array("2,0,0,3,0,96,220,0,0,96,96,22,8,50,83,8,0,0,12,-0.2,0")
when 1
chara_st[0] = Array("2,0,0,3,0,0,0,0,0,96,96,22,8,50,83,5,0,0,15,-0.2,0")
chara_st[0][5] = 3 * getVariable("ブロックサイズ"); chara_st[0][6] = 44 * getVariable("ブロックサイズ")
when 2
chara_st[0] = Array("2,0,0,3,0,0,0,0,0,96,96,22,8,50,83,10,0,0,14,-0.20,0")
chara_st[0][5] = 1 * getVariable("ブロックサイズ"); chara_st[0][6] = 6 * getVariable("ブロックサイズ")
end
chara_st[0][17] = chara_st[0][6]; chara_st[0][20] = chara_st[0][5]
chara_st[0][15] = chara_st[0][15] + LVL - 1; chara_st[0][18] = chara_st[0][18] + (LVL * 2) - 1;chara_st[0][19] = chara_st[0][19] * LVL #
#chara_st[1] = Array("3,1,0,0,0,500,472,0,0,96,96,20,0,56,96,8,0,0,10,0,0"); chara_st[1][17] = chara_st[1][6]; chara_st[1][20] = chara_st[1][5]
#キャラスプライト管理
chara_sp = createArray()
chara_sp[0] = createSprite(CHARASPid[chara_st[0][0]])
#chara_sp[1] = createSprite(CHARASPid[chara_st[1][0]])
#マップ設定
#maps = <<EOS
#AtAtAtAtAtAtAtAaAtAtAtAtAt
#Ae
#As
#AsAtAaAaAaAa
#As
#AsAtAtAtAtAtAaAtAtAbAcAdAtAtAtAtAtAtAtAtAtAaAtAtAtAtAtAtAbAcAd
#As
#As
#As
#As
#AsAtAtAtAtAtAtAaAtAtAtAtAtAtAtAaAt
#CrAcAcAcAcAcAcAdAtAtAbAcAcAcAcAcAcAcAcAcAcAcAcAcAcAdAtAtAbAdAt
#
#
#NsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNsNs
#EOS
case stg
when 0
mapsnd = <<EOS #マップ数値データ(後ろに,を付けること)
201, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 176,
426, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 451, 451, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 452, 451, 476,
450, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 426, 476, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 464, 475, 475, 475, 475, 475, 475, 426, 476,
450, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 427, 476, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 464, 475, 475, 475, 475, 475, 475, 426, 476,
450, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 450, 475, 475, 475, 475, 475, 475, 25, 75, 475, 475, 475, 475, 475, 464, 475, 475, 475, 475, 475, 475, 426, 476,
450, 475, 475, 475, 475, 475, 475, 475, 25, 50, 50, 75, 475, 475, 475, 475, 25, 50, 50, 50, 50, 75, 475, 475, 475, 475, 475, 450, 475, 475, 125, 175, 475, 475, 475, 475, 475, 475, 475, 475, 475, 464, 475, 475, 475, 475, 475, 475, 426, 476,
450, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 425, 475, 475, 427, 477, 475, 475, 475, 475, 475, 475, 475, 475, 475, 464, 475, 475, 475, 475, 475, 475, 426, 476,
450, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 464, 475, 475, 475, 475, 475, 475, 426, 476,
450, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 464, 475, 475, 475, 475, 475, 475, 426, 476,
450, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 25, 50, 50, 50, 50, 50, 50, 50, 75, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 25, 50, 50, 50, 75, 475, 475, 464, 475, 475, 475, 204, 229, 254, 426, 476,
450, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 464, 475, 475, 475, 429, 454, 479, 426, 476,
450, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 464, 475, 475, 475, 429, 454, 479, 426, 476,
350, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 75, 475, 475, 475, 475, 475, 475, 475, 25, 50, 50, 50, 50, 50, 50, 377, 477,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475,
463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463,
EOS
when 1
mapsnd = <<EOS
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 475, 475, 475, 475, 475, 475, 475, 464, 475, 475, 464, 475, 475, 475, 475, 475, 475, 475, 3,
3, 475, 475, 475, 475, 475, 475, 475, 464, 475, 475, 464, 475, 475, 475, 475, 475, 475, 475, 3,
3, 475, 475, 475, 475, 475, 475, 475, 464, 404, 475, 464, 475, 475, 3, 475, 475, 475, 475, 3,
3, 475, 475, 475, 3, 3, 3, 3, 3, 3, 3, 3, 475, 475, 475, 475, 475, 475, 3, 3,
3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3,
3, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 3,
3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 475, 475, 3,
3, 475, 475, 475, 475, 3, 475, 475, 475, 475, 475, 475, 3, 3, 475, 475, 475, 475, 475, 3,
3, 3, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 475, 475, 475, 475, 475, 3,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 475,
475, 475, 475, 3, 3, 475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475, 475, 475, 475,
3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
3, 475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475, 475, 475, 3, 3, 475, 475, 475,
3, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3,
3, 475, 475, 475, 178, 3, 3, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3,
3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 3, 475, 475, 475, 475, 475, 475, 475,
3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 3, 475, 475,
475, 3, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 3, 3, 3, 475, 475, 475, 3, 475, 475, 475, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
475, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 475, 475,
475, 475, 475, 475, 475, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
475, 475, 475, 475, 3, 475, 475, 475, 475, 475, 3, 3, 475, 475, 475, 475, 475, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475,
475, 475, 475, 3, 475, 475, 475, 475, 3, 3, 475, 475, 475, 475, 475, 475, 3, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475, 3, 475, 475,
3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
475, 475, 475, 475, 475, 475, 3, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475, 3,
475, 3, 475, 475, 475, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
475, 475, 475, 475, 3, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 3,
475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475,
0, 475, 3, 3, 475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 3, 475, 475, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 475, 475,
475, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475, 475, 3, 475, 475, 475, 3, 475, 475, 475,
475, 475, 475, 475, 475, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
475, 475, 475, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 3, 475, 475, 475, 475, 475,
3, 475, 475, 475, 475, 475, 475, 475, 475, 3, 3, 475, 475, 475, 475, 475, 475, 3, 3, 475,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475,
475, 475, 475, 475, 475, 475, 3, 3, 475, 475, 475, 475, 3, 3, 475, 475, 475, 475, 475, 475,
3, 3, 3, 3, 3, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, 3, 3, 3, 3, 3,
EOS
when 2
mapsnd = <<EOS
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 464, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 464, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 475, 475, 178, 475, 475, 178, 178, 475, 475, 178, 178, 475, 475, 475, 475, 178, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 178, 475, 475, 475, 475, 178, 178, 178, 178, 475, 475, 475, 475, 178, 178, 178, 178, 475, 475, 475,
178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 475, 475, 178, 475, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 475, 475, 178, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 475, 475, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 475, 475, 475, 475, 178, 178, 178, 475, 475, 475, 178, 178, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 475, 178, 178, 475, 475, 475,
475, 475, 475, 475, 475, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 475,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 475, 475, 475, 475, 475, 475, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 204, 229, 254,
475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 429, 454, 479,
178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 475, 475, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 178, 178, 178, 475, 475, 178, 178, 475, 475, 178, 475, 178, 475, 178, 475, 178, 475, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 475, 475, 475, 475, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 475, 475, 178, 178, 178, 178, 178, 178, 178, 178, 178,
EOS
end
maps = enc(mapsnd, 25) #アルファベットデータに変換 (x20,y25)
MapSet(maps)
#マップ表示 ついでに当たり判定
setVariable("当たり判定", createArray())
d = 0
while d < getVariable("マップ高")
getVariable("当たり判定")[d] = createArray()
i = 0
while i < getVariable("マップ長")
getVariable("当たり判定")[d][i] = 0
i = i + 1
end
d = d + 1
end
mapspr = createArray()
d = 0; j = 0
while d < getVariable("マップ高")
i = 0
while i < getArrayLength(getVariable("マップデータ")[d])
nan = getVariable("マップデータ")[d][i]
if nan == "Ns"
getVariable("当たり判定")[d][i] = 2 #落下判定用
elsif nan == "Os"
getVariable("当たり判定")[d][i] = 3 #ゴール判定用
elsif nan != "At"
mapspr[j] = createSprite(CHARASPid[1])
BGprint(mapspr[j], nan, i * getVariable("ブロックサイズ"), d * getVariable("ブロックサイズ"), mapZ)
getVariable("当たり判定")[d][i] = 1
end
i = i + 1; j = j + 1
end
d = d + 1
end
#背景
bg = createSprite(CHARASPid[0])
setSpriteRect(bg, 0, 0, 800, 600, 0, 0, 800, 600)
setSpriteZOrder(bg, bgZ)
#カメラ独立設定
setSpriteIndependentCamera(bg, true)
#_/_/_/_/_/_/_/_/メインループ_/_/_/_/_/_/_/_/
startInput()
playSound(SNDid[0])
drawCanvas()
while !OVA
#_/_/_/_/_/_/_/_/リセット処理_/_/_/_/_/_/_/_/
id = 0 #一時保管用
#_/_/_/_/_/_/_/_/メッセージ_/_/_/_/_/_/_/_/
case m
when 0
if time == 0
setText(txt1, "S T A R T\n Lv." + LVL)
elsif time == 70
playBGM(BGMid)
setMusicVolume(2)
setText(txt1, "")
end
when 1
setText(txt1, "ゴーール!")
fadeOutMusicStop(2000)
playSound(SNDid[3])
m = 3
k = time
when 2 #ゲームオーバー
setText(txt1, "ゲームオーバー")
stopBGM()
playSound(SNDid[4])
waitTime(2000)
if getFlag("デバッグ")
OVA = true
else
goBadEnding()
end
when 3
if time > (k + 100)
case speakWithSelect(2, "はい", "いいえ", "記録を残しますか?\n※ログインしているユーザー限定")
when 0
te = "ステージ:"+ (stg + 1) +" 記録:Lv." + LVL + " カウント:" + k
openActivityFeedWindow(te)
end
case speakWithSelect(2, "はい", "いいえ", "ゲームを続けますか?")
when 0
OVA = true
when 1
goEnding()
end
end
end
#_/_/_/_/_/_/_/_/キャラ表示_/_/_/_/_/_/_/_/
i = 0
while i < getArrayLength(chara_st)
if (time % 10) == 0 then chara_st[i][2] = chara_st[i][2] + 1; end
p = 0 #向きによって値を足す
ord = 0 #正の向きなら何番か
ani = chara_st[i][2] % ani_kind[i][chara_st[i][3]] #アニメ用にいくつ足すか カウント % アニメ数
if chara_st[i][4] == 1 then p = 20; end
case chara_st[i][3]
when 0
ord = 0
when 1
ord = 4
when 2
ord = 8
when 3
ord = 12
when 4
ord = 16
end
b = ord + p + ani
case chara_st[i][1]
when 0
setSpriteRect(chara_sp[i], MYanm[b][0], MYanm[b][1], MYanm[b][2], MYanm[b][3], chara_st[i][5], chara_st[i][6], chara_st[i][9], chara_st[i][10])
setSpriteZOrder(chara_sp[i], plZ)
when 1
end
i = i + 1
end
#_/_/_/_/_/_/_/_/プレーヤーコントロール_/_/_/_/_/_/_/_/
#_/キー入力_/
while hasInput()
takeInput()
if isKeyDown("Z") || isKeyDown("UP") #ジャンプキー
if chara_st[0][3] == 2 #ジャンプ中に押したら
keyFlag[0] = 2
else
keyFlag[0] = keyFlag[0] + 1
end
elsif isKeyUp("Z") || isKeyUp("UP")
keyFlag[0] = 0
end
if isKeyDown("RIGHT") then keyFlag[1] = 1; keyFlag[2] = 0; chara_st[0][4] = 0; end
if isKeyDown("LEFT") then keyFlag[2] = 1; keyFlag[1] = 0; chara_st[0][4] = 1; end
if isKeyUp("LEFT") then keyFlag[2] = 0; end
if isKeyUp("RIGHT") then keyFlag[1] = 0; end
if isKeyUp("D") then setFlag("デバッグ",true); end
end
#動作指定
if ((keyFlag[1] == 1) || (keyFlag[2] == 1)) && ((chara_st[0][3] != 2) && (chara_st[0][3] != 3)) #空中にいなければ移動
chara_st[0][3] = 1
elsif chara_st[0][3] == 1
chara_st[0][3] = 0
chara_st[0][16] = 0
end
if (keyFlag[0] == 1) && (chara_st[0][3] != 2) && (chara_st[0][3] != 3) #空中にいなければジャンプ
chara_st[0][3] = 2
end
#_/行動判定_/
if chara_st[0][3] == 0 #停止
FT = chara_st[0][15] / 10
if (chara_st[0][4] == 0) && (0 < chara_st[0][16])
chara_st[0][16] = chara_st[0][16] - FT #速度下げ
chara_st[0][20] = chara_st[0][5]; chara_st[0][5] = chara_st[0][5] + chara_st[0][16]
elsif (chara_st[0][4] == 1) && (0 > chara_st[0][16])
chara_st[0][16] = chara_st[0][16] + FT
chara_st[0][20] = chara_st[0][5]; chara_st[0][5] = chara_st[0][5] + chara_st[0][16]
else
chara_st[0][16] = 0
chara_st[0][20] = chara_st[0][5]; chara_st[0][5] = chara_st[0][5] + chara_st[0][16]
end
elsif chara_st[0][3] == 1 #進行
FS = chara_st[0][15] / 10
if chara_st[0][4] == 0
if chara_st[0][15] > chara_st[0][16] then chara_st[0][16] = chara_st[0][16] + FS; else chara_st[0][16] = chara_st[0][15]; end #速度上げ
elsif chara_st[0][4] == 1
if -chara_st[0][15] < chara_st[0][16] then chara_st[0][16] = chara_st[0][16] - FS; else chara_st[0][16] = -chara_st[0][15]; end #速度上げ
end
chara_st[0][20] = chara_st[0][5]; chara_st[0][5] = chara_st[0][5] + chara_st[0][16]
elsif chara_st[0][3] == 2 #ジャンプ中
FJ = chara_st[0][19]
if keyFlag[0] == 1
FJ = chara_st[0][18]
keyFlag[0] = keyFlag[0] + 1 #長押し防止
playSound(SNDid[1])
end
ytemp = chara_st[0][6]
chara_st[0][6] = chara_st[0][6] + (chara_st[0][6] - (chara_st[0][17] - 0.5) - FJ)
chara_st[0][17] = ytemp
chara_st[0][20] = chara_st[0][5]; chara_st[0][5] = chara_st[0][5] + chara_st[0][16]
elsif chara_st[0][3] == 3 #落下中
ytemp = chara_st[0][6]
chara_st[0][6] = chara_st[0][6] + (chara_st[0][6] - (chara_st[0][17] - 0.5) - chara_st[0][19])
chara_st[0][17] = ytemp
chara_st[0][20] = chara_st[0][5]; chara_st[0][5] = chara_st[0][5] + chara_st[0][16]
else
end
#_/当たり判定_/
yi = chara_st[0][6]
xi = chara_st[0][5]
#speak("xi = "+xi+"\nyi = "+yi)
if yi > chara_st[0][17] #Y下方向に進んでる
SFY = 1
elsif yi < chara_st[0][17]
SFY = 2
else
SFY = 0
end
if xi > chara_st[0][20] #X右方向に進んでる
SFX = 1
elsif xi < chara_st[0][20]
SFX = 2
else
SFX = 0
end
while (SFX != 0) || (SFY != 0)
i = 1
while i > 0
i = 0
Y = floor((chara_st[0][6] + chara_st[0][12]) / getVariable("ブロックサイズ")) #上
ml = (chara_st[0][14] - chara_st[0][12]) / 2 #当たり判定長さ/2
Y1 = floor((chara_st[0][6] + chara_st[0][12] + ml / 2) / getVariable("ブロックサイズ")) #上中央
Y2 = floor((chara_st[0][6] + chara_st[0][12] + ml) / getVariable("ブロックサイズ")) #中央
Y3 = floor((chara_st[0][6] + chara_st[0][12] + ml + ml / 2) / getVariable("ブロックサイズ")) #下中央
Y4 = floor((chara_st[0][6] + chara_st[0][12] + chara_st[0][14]) / getVariable("ブロックサイズ")) #下
PY4 = floor((chara_st[0][6] + 1 + chara_st[0][12] + chara_st[0][14]) / getVariable("ブロックサイズ")) #下
X = floor((chara_st[0][5] + chara_st[0][11]) / getVariable("ブロックサイズ")) #上
ml = (chara_st[0][13] - chara_st[0][11]) / 2 #当たり判定長さ/2
X1 = floor((chara_st[0][5] + chara_st[0][11] + ml / 2) / getVariable("ブロックサイズ")) #上中央
X2 = floor((chara_st[0][5] + chara_st[0][11] + ml) / getVariable("ブロックサイズ")) #中央
X3 = floor((chara_st[0][5] + chara_st[0][11] + ml + ml / 2) / getVariable("ブロックサイズ")) #下中央
X4 = floor((chara_st[0][5] + chara_st[0][11] + chara_st[0][13]) / getVariable("ブロックサイズ")) #下
if getFlag("デバッグ") then setText(textID, "X = "+X+"\nX1 = "+X1+"\nX2 = "+X2+"\nX3 = "+X3+"\nX4 = "+X4+"\nY = "+Y+"\nY1 = "+Y1+"\nY2 = "+Y2+"\nY3 = "+Y3+"\nY4 = "+Y4); end
if (((getVariable("当たり判定")[Y][X] == 1) && (getVariable("当たり判定")[Y][X1] == 1)) || (getVariable("当たり判定")[Y][X2] == 1) || ((getVariable("当たり判定")[Y][X3] == 1) && (getVariable("当たり判定")[Y][X4] == 1))) && (SFY == 2) #上側
chara_st[0][6] = chara_st[0][6] + 1
if chara_st[0][3] == 2
chara_st[0][3] = 3
end
i = i + 1
elsif (((getVariable("当たり判定")[Y4][X] == 1) && (getVariable("当たり判定")[Y4][X1] == 1)) || (getVariable("当たり判定")[Y4][X2] == 1) || ((getVariable("当たり判定")[Y4][X3] == 1) && (getVariable("当たり判定")[Y4][X4] == 1))) && (SFY == 1) #下側
chara_st[0][6] = chara_st[0][6] - 1
if (chara_st[0][3] == 2) || (chara_st[0][3] == 3)
chara_st[0][3] = 0
end
chara_st[0][17] = chara_st[0][6]
i = i + 1
elsif (((getVariable("当たり判定")[Y4][X] == 2) && (getVariable("当たり判定")[Y4][X1] == 2) && (getVariable("当たり判定")[Y4][X2] == 2) && (getVariable("当たり判定")[Y4][X3] == 2) && (getVariable("当たり判定")[Y4][X4] == 2)) || ((X < -1) || (X4 > getVariable("マップ長")) || (Y4 > getVariable("マップ高")))) && (m == 0) #下側
m = 2
i = -10
SFX = 0; SFY = 0
else
SFY = 0
end
if (getVariable("当たり判定")[PY4][X1] != 1) && (getVariable("当たり判定")[PY4][X2] != 1) && (getVariable("当たり判定")[PY4][X3] != 1) #擬似重力
if (chara_st[0][3] != 2) && (chara_st[0][3] != 3)
chara_st[0][3] = 3
end
end
if (((getVariable("当たり判定")[Y][X] == 1) && (getVariable("当たり判定")[Y1][X] == 1)) || (getVariable("当たり判定")[Y2][X] == 1) || ((getVariable("当たり判定")[Y3][X] == 1) && (getVariable("当たり判定")[Y4][X] == 1))) && (SFX == 2) #左側
chara_st[0][5] = chara_st[0][5] + 1
if (getVariable("当たり判定")[Y1][X] == 1) || (getVariable("当たり判定")[Y2][X] == 1) || (getVariable("当たり判定")[Y3][X] == 1)
chara_st[0][16] = 0
end
chara_st[0][20] = chara_st[0][5]
i = i + 1
#speak("左")
elsif (((getVariable("当たり判定")[Y][X4] == 1) && (getVariable("当たり判定")[Y1][X4] == 1)) || (getVariable("当たり判定")[Y2][X4] == 1) || ((getVariable("当たり判定")[Y3][X4] == 1) && (getVariable("当たり判定")[Y4][X4] == 1))) && (SFX == 1) #右側
chara_st[0][5] = chara_st[0][5] - 1
if (getVariable("当たり判定")[Y1][X4] == 1) || (getVariable("当たり判定")[Y2][X4] == 1) || (getVariable("当たり判定")[Y3][X4] == 1)
chara_st[0][16] = 0
end
chara_st[0][20] = chara_st[0][5]
i = i + 1
else
SFX = 0
end
if (getVariable("当たり判定")[Y2][X2] == 3) && (m == 0)
m = 1
end
end
end
#_/_/_/_/_/_/_/_/モブコントロール_/_/_/_/_/_/_/_/
#_/_/_/_/_/_/_/_/マップスクロール処理_/_/_/_/_/_/_/_/
CameraX = chara_st[0][5] + chara_st[0][9] / 2 - 400
CameraY = chara_st[0][6] + chara_st[0][10] / 2 - 300
setSpriteCameraPosition(CameraX, CameraY)
time = time + 1
drawCanvas()
waitTime(0)
end #メインループ
end #帰還用ループ
全部開始スクリプトに書いてます。
もうすこし完成形に近づけたいなぁー。
コメントする
コメントするには、ログインする必要があります。
コメント一覧
コメントはありません。