Created
July 29, 2025 12:02
-
-
Save skymonsters-Ks/0334cc83c84e8e0fd1c4b8a4c466fe12 to your computer and use it in GitHub Desktop.
スペースハリアー風味
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #use hsp3dish | |
| #packopt xsize 960 | |
| #packopt ysize 720 | |
| #define SCR_W 320.0 | |
| #define SCR_H 240.0 | |
| #const ZOOM_W 3 | |
| #const ZOOM_H 3 | |
| #const WIN_W SCR_W * ZOOM_W | |
| #const WIN_H SCR_H * ZOOM_H | |
| #const TILE_WH 2 | |
| #const GRN_W SCR_W + TILE_WH | |
| #const GRN_H TILE_WH | |
| screen 0, WIN_W, WIN_H | |
| title "SH" | |
| repeat 32 | |
| bufw = 1 << cnt | |
| if GRN_W < bufw : break | |
| loop | |
| buffer 2, bufw, GRN_H, screen_offscreen | |
| dim bmp, bufw * GRN_H | |
| repeat bufw / 2 | |
| bmp(cnt * 2) = $ffaaffaa, $ff70d770 | |
| bmp(cnt * 2 + bufw) = $ff99ff99, $ff80e880 | |
| loop | |
| celbitmap 2, bmp, celbitmap_bgr | |
| px = SCR_W / 2 | |
| py = SCR_H / 2 | |
| sx = 0.0 | |
| sz = 0.0 | |
| hp = py | |
| pers = 30.0 | |
| ptime = timer() | |
| dtt = 0 | |
| fcnt = 0 | |
| fps = 0 | |
| gsel 0 | |
| *mainLoop | |
| ntime = timer() | |
| dt = limit(ntime - ptime, 0, 1000) | |
| dtt += dt | |
| if dtt >= 1000 { | |
| fps = fcnt | |
| dtt -= 1000 | |
| fcnt = 0 | |
| } else { | |
| fcnt++ | |
| } | |
| ptime = ntime | |
| stick k, 15 + 256 | |
| pv = 0.5 * dt | |
| if k & 256 { | |
| follow px, mousex / ZOOM_W, pv | |
| follow py, mousey / ZOOM_H, pv | |
| } else { | |
| if k & 1 : px -= pv | |
| if k & 4 : px += pv | |
| if k & 2 : py -= pv | |
| if k & 8 : py += pv | |
| } | |
| px = limitf(px, 20, SCR_W - 20) | |
| py = limitf(py, 30, SCR_H - 30) | |
| sx += (px - SCR_W / 2) / 7000 * dt | |
| sx \= TILE_WH | |
| if sx < 0 : sx += TILE_WH | |
| sz += 0.01 * dt | |
| sz \= TILE_WH | |
| follow hp, py, 0.25 * dt | |
| redraw 0 | |
| viewcalc vptype_2d, ZOOM_W, ZOOM_H | |
| rgbcolor $eeaaff | |
| boxf | |
| h = 140 - hp / 2 | |
| r = pers / h | |
| repeat h | |
| a = r * cnt + 1 | |
| x = a * SCR_W | |
| y = 2.0 / tan(a / pers) | |
| pos (SCR_W - x) / 2 - (sx \ 1) * a, SCR_H - h + cnt | |
| gzoom x, 1, 2, sx, (sz + y) \ GRN_H, SCR_W, 1 | |
| loop | |
| gmode 3,,,60 | |
| color | |
| repeat 15 | |
| grect px, SCR_H - 3 - cnt, , sin(M_PI / 14 * cnt) * 30 + 30, 2 | |
| loop | |
| gmode 0 | |
| pobj $88bbe0, -6, 10, -1.0, 40, 10 ; l leg | |
| pobj $88bbe0, 10, 10, 0.9, 20, 10 ; r leg | |
| pobj $f08070, 0, -10, -0.3, 22, 18 ; body | |
| pobj $d02020, 8, -8, 0.8, 10, 10 ; weapon | |
| pobj $dde870, -3, -22, 0.8, 10, 10 ; head | |
| viewcalc vptype_2d, 1, 1 | |
| pos 0, 0 | |
| color | |
| mes "FPS: " + fps | |
| mes "Move: arrow key/mouse/touch" | |
| redraw 1 | |
| await 1 | |
| goto *mainLoop | |
| #deffunc pobj int _col, int _x, int _y, double _ang, int _w, int _h | |
| rgbcolor _col : grect px + _x, py + _y, _ang, _w, _h | |
| return | |
| #defcfunc timer local _t | |
| getreq _t, SYSREQ_TIMER | |
| return _t | |
| #deffunc follow var _my, double _tgt, double _v | |
| if abs(_tgt - _my) < _v { | |
| _my = _tgt | |
| } else { | |
| if _tgt > _my : _my += _v | |
| if _tgt < _my : _my -= _v | |
| } | |
| return |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
WebDishで実行:https://dev.onionsoft.net/seed/webdish/e01a41e4b6925cc30f165ec2845166a7.html