0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

HSP3.6でメキシカンハット

Posted at

概要

巷でメキシカンハットチャレンジが流行っていると聞いてHSP3.6に移植してみました。BASICが源流のHot Soup Processorだけあって元コードの雰囲気で書けている気がします。

screen 0, 640, 480, 0 : cls 4
dim d, 160 : repeat 159, 1 : d(cnt) = 100 : loop : dr = M_PI / 180.0
y = -180
repeat
	x = -180
	repeat
		r = dr * sqrt(double(x*x + y*y))
		z = 100.0 * cos(r) - 30.0 * cos(3.0 * r)
		sx = int(80.0 + double(x) / 3.0 - double(y) / 6.0)
		sy = int(40.0 - double(y) / 6.0 - double(z) / 4.0)
		if (sx < 0) + (sx >= 160) : goto *skip
		if d(sx) <= sy : goto *skip
		zz = int((z + 100.0) * 0.035) + 1
		rc = 0 : gc = 0 : bc = 0
		if (zz==1) + (zz==3) + (zz==5) + (zz==7) : bc = 255
		if (zz==2) + (zz==3) + (zz>=6) : rc = 255
		if zz >= 4 : gc = 255
		if (rc != 0) + (gc != 0) + (bc != 0) {
			color rc, gc, bc : boxf sx*4, sy*4, sx*4+2, sy*4+2
		}
		d(sx) = sy
*skip
		x += 4
		if x > 180 : break
	loop
	y += 6
	if y > 180 : break
loop
実行結果
mexi1.png
psetだと光量が足りない感じだったのでboxfで大きくしました

参照

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?