短時間?ゲーム制作その2。制作時間4時間…HSP 3.4β2, Win XP で動作確認しています。
短時間?ゲーム制作その2。制作時間4時間…HSP 3.4β2, Win XP で動作確認しています。
sz = 32buffer 1, sz, szfont msgothic, szcolorboxfcolor 255, 255, 255mes "☆"gseltitle "Star: The Gathering"celdiv 1, , , sz / 2, sz / 2starNum = 100font "arial", 24*initddim starPosX, starNumddim starPosY, starNumddim starPosX, starNumddim starVelY, starNumrepeat starNumgenStar cntloopdim gstarLife, starNumddim gstarPosX, starNumddim gstarPosY, starNumcircleSize = 0.0*mainLoopstick key, 256if (scene) {if (key & 256) {mlbDown = 1circleSize += 1.0if (circleSize > 120) {circleSize = 120.0}} else {if (mlbDown) {gatherNum = 0repeat starNumx = mousex - starPosX(cnt)y = mousey - starPosY(cnt)if (sqrt(x * x + y * y) <= circleSize) {score++gstarLife(gsIdx) = 10gstarPosX(gsIdx) = starPosX(cnt)gstarPosY(gsIdx) = starPosY(cnt)gsIdx = (gsIdx + 1) \ starNumgenStar cnt}loop}mlbDown = 0circleSize = 0.0}if (key & 128) {scene = 0}} else {if (key & 16) {score = 0remain = 66 * 30scene = 1goto *init}}repeat starNumstarPosX(cnt) += starVelX(cnt)starPosY(cnt) += starVelY(cnt)starVelX(cnt) *= 0.998starVelY(cnt) *= 0.998if (starPosX(cnt) < 0) {starPosX(cnt) = -starPosX(cnt)starVelX(cnt) = -starVelX(cnt)}if (starPosX(cnt) > 640) {starPosX(cnt) = 1280.0 - starPosX(cnt)starVelX(cnt) = -starVelX(cnt)}if (starPosY(cnt) < 0) {starPosY(cnt) = -starPosY(cnt)starVelY(cnt) = -starVelY(cnt)}if (starPosY(cnt) > 480) {starPosY(cnt) = 960.0 - starPosY(cnt)starVelY(cnt) = -starVelY(cnt)}looprepeat starNumif (gstarLife(cnt) > 0) {gstarLife(cnt)--}loopredraw 0colorboxfgmode 2repeat starNumpos starPosX(cnt), starPosY(cnt)celput 1looprepeat starNumif (gstarLife(cnt) > 0) {pos gstarPosX(cnt), gstarPosY(cnt)gmode 5, , , gstarLife(cnt) * 30 + 40s = 0.4 * (7 - gstarLife(cnt)) + 1celput 1, , s, s}loopif (scene) {color 255, 255, 255circle mousex - circleSize, mousey - circleSize, mousex + circleSize, mousey + circleSize, 0}gmode 3, , , 200colorgrect 320, 15, , 200, 30color 255, 255, 255pos 270, 0mes strf("%3d", score)pos 340, 0mes strf("%2.1f", double(remain) / 66)if (scene = 0) {colorgrect 340, 250, , 340, 160color 255, 255, 255pos 200, 200mes "Star: The Gathering"mes ""mes "Space key: start"mes "Mouse Left button: gather"}redrawawait 15if (scene) {remain--if (remain == 0) {scene = 0}}goto *mainLoop#deffunc genStar int _idstarPosX(_id) = double(rnd(640))starPosY(_id) = double(rnd(480))starVelX(_id) = (double(rnd(100)) / 10) * (rnd(2) * 2 - 1)starVelY(_id) = (double(rnd(100)) / 10) * (rnd(2) * 2 - 1)return