Last active
April 30, 2020 01:46
-
-
Save skymonsters-Ks/f32b96021ce3214d4ceae8d13b3b1528 to your computer and use it in GitHub Desktop.
ラスタースクロール的なやつ
This file contains 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
#const RECT 32 | |
#const WIN_W 16 * RECT | |
#const WIN_H 10 * RECT | |
screen 0, WIN_W, WIN_H | |
buffer 1, WIN_W * 2, WIN_H * 2 | |
repeat WIN_W * 2 / RECT : w = cnt | |
repeat WIN_H * 2 / RECT : h = cnt | |
x = w * RECT * 2 + h \ 2 * RECT | |
y = h * RECT | |
boxf x, y, x + RECT - 1, y + RECT - 1 | |
loop | |
loop | |
gsel 0 | |
sx = 0.0 | |
sy = 0.0 | |
vx = 1.0 | |
vy = 0.8 | |
*mainLoop | |
stick k, 15 | |
if k & 1 : sx -= vx : if sx < 0 : sx += WIN_W | |
if k & 4 : sx += vx : if sx > WIN_W : sx -= WIN_W | |
if k & 2 : sy -= vy : if sy < 0 : sy += WIN_H | |
if k & 8 : sy += vy : if sy > WIN_H : sy -= WIN_H | |
redraw 0 | |
y = 0.0 | |
repeat WIN_H | |
a = (1.5 * (sin(M_PI + M_PI * cnt / WIN_H) + 1) + 1) | |
x = a * WIN_W | |
y += 1.0 / a | |
pos (WIN_W - x) / 2, cnt | |
gzoom x, 1, 1, sx, sy + y, WIN_W, 1 | |
loop | |
redraw 1 | |
await 15 | |
goto *mainLoop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://twitter.com/skymonsters_Ks/status/1255314541841453057