ウチツクシ

やったゲームのこと(大体STG)とか作ったゲームのこと

Arrows Attack ソースコード

整理前のコードは http://codetter.com/?p=1027

; HSP 3.4β2
#packopt name "START"
#packopt hide 1
#define GAMETITLE "Arrows Attack"
    buffer 1, 800, 200
    font msgothic, 200, 16
    mes "←↑→↓"
    arrow = 1, 2, 4, 8
    celdiv 1, 200, , 100, 100
    gsel 0, 1
    title GAMETITLE
    font "arial", 30, 16
    scene = 1
    mespx = 170, 230, 285, 250
    mespy = 380,  80,  80,  80
    mestx = "SPACE key to START", GAMETITLE, "Miss!", "Time's up!"
*init
    randomize
    nowNo = rnd(4)
    remain = 66 * 10
    arrowAni = 4
    score = 0
*mainLoop
    stick key
    if (scene) {
        if (key & 16) {
            scene = 0
            goto *init
        }
    } else {
        if (key & 15) {
            if (key == arrow(nowNo)) {
                score++
                nowNo = rnd(4)
                arrowAni = 4
            } else {
                scene = 2
            }
        }
    }
    redraw 0
    color 255, 255, 255
    boxf
    if (scene != 1) {
        pos 320, 240
        arrowAni -= arrowAni > 0
        celput 1, nowNo, 0.2 * arrowAni + 1, 0.2 * arrowAni + 1
    }
    color
    pos 100, 224
    mes score
    pos 480, 224
    mes strf("%2.2f", double(remain) / 66)
    if (scene) {
        pos mespx(scene), mespy(scene)
        mes mestx(scene)
        pos mespx, mespy
        mes mestx
    }
    redraw
    await 15
    if (scene == 0) {
        remain--
        if (remain == 0) {
            scene = 3
        }
    }
    goto *mainLoop