From 57b8800a6ee85915a82c8cecdcf0df0d63d3ae66 Mon Sep 17 00:00:00 2001 From: mguinhos Date: Tue, 27 Oct 2026 03:17:41 -0300 Subject: [PATCH] Exemplo: minecraft em notacao do forum Co-Authored-By: Claude Opus 5.5 --- minecraft.scratchblocks | 346 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 346 insertions(+) create mode 100644 minecraft.scratchblocks diff --git a/minecraft.scratchblocks b/minecraft.scratchblocks new file mode 100644 index 0000000..c29ff49 --- /dev/null +++ b/minecraft.scratchblocks @@ -0,0 +1,346 @@ +when flag clicked +set [W v] to (96) +set [H v] to (72) +set [F v] to (80) +set [tela v] to (nova imagem (96) x (72) cor r (135) g (200) b (255) :: extension) +delete all of [alt v] +set [i v] to (0) +repeat (8) + set [j v] to (0) + repeat (8) + add (limite (round ((2.5) + ((([sin v] of ((i) * (55))) + ([cos v] of ((j) * (47)))) * (1.3)))) entre (1) e (4) :: operators) to [alt v] + change [j v] by (1) + end + change [i v] by (1) +end +delete all of [V v] +delete all of [C v] +delete all of [N v] +set [i v] to (0) +repeat (8) + set [j v] to (0) + repeat (8) + set [hh v] to (item ((((i) * (8)) + (j)) + (1)) of [alt v]) + add (i) to [V v] + add (hh) to [V v] + add (j) to [V v] + add ((i) + (1)) to [V v] + add (hh) to [V v] + add (j) to [V v] + add ((i) + (1)) to [V v] + add (hh) to [V v] + add ((j) + (1)) to [V v] + add (i) to [V v] + add (hh) to [V v] + add ((j) + (1)) to [V v] + add [95] to [C v] + add [165] to [C v] + add [60] to [C v] + add [0] to [N v] + add [1] to [N v] + add [0] to [N v] + if <(i) = (0)> then + set [nh v] to (0) + else + set [nh v] to (item (((((i) - (1)) * (8)) + (j)) + (1)) of [alt v]) + end + set [yy v] to (nh) + repeat ((hh) - (nh)) + if <(yy) = ((hh) - (1))> then + set [cr v] to ((134) * (0.8)) + set [cg v] to ((96) * (0.8)) + set [cb v] to ((67) * (0.8)) + else + set [cr v] to ((128) * (0.8)) + set [cg v] to ((128) * (0.8)) + set [cb v] to ((132) * (0.8)) + end + add (i) to [V v] + add (yy) to [V v] + add (j) to [V v] + add (i) to [V v] + add (yy) to [V v] + add ((j) + (1)) to [V v] + add (i) to [V v] + add ((yy) + (1)) to [V v] + add ((j) + (1)) to [V v] + add (i) to [V v] + add ((yy) + (1)) to [V v] + add (j) to [V v] + add (cr) to [C v] + add (cg) to [C v] + add (cb) to [C v] + add [-1] to [N v] + add [0] to [N v] + add [0] to [N v] + change [yy v] by (1) + end + if <(i) = (7)> then + set [nh v] to (0) + else + set [nh v] to (item (((((i) + (1)) * (8)) + (j)) + (1)) of [alt v]) + end + set [yy v] to (nh) + repeat ((hh) - (nh)) + if <(yy) = ((hh) - (1))> then + set [cr v] to ((134) * (0.8)) + set [cg v] to ((96) * (0.8)) + set [cb v] to ((67) * (0.8)) + else + set [cr v] to ((128) * (0.8)) + set [cg v] to ((128) * (0.8)) + set [cb v] to ((132) * (0.8)) + end + add ((i) + (1)) to [V v] + add (yy) to [V v] + add (j) to [V v] + add ((i) + (1)) to [V v] + add (yy) to [V v] + add ((j) + (1)) to [V v] + add ((i) + (1)) to [V v] + add ((yy) + (1)) to [V v] + add ((j) + (1)) to [V v] + add ((i) + (1)) to [V v] + add ((yy) + (1)) to [V v] + add (j) to [V v] + add (cr) to [C v] + add (cg) to [C v] + add (cb) to [C v] + add [1] to [N v] + add [0] to [N v] + add [0] to [N v] + change [yy v] by (1) + end + if <(j) = (0)> then + set [nh v] to (0) + else + set [nh v] to (item (((i) * (8)) + (j)) of [alt v]) + end + set [yy v] to (nh) + repeat ((hh) - (nh)) + if <(yy) = ((hh) - (1))> then + set [cr v] to ((134) * (0.62)) + set [cg v] to ((96) * (0.62)) + set [cb v] to ((67) * (0.62)) + else + set [cr v] to ((128) * (0.62)) + set [cg v] to ((128) * (0.62)) + set [cb v] to ((132) * (0.62)) + end + add (i) to [V v] + add (yy) to [V v] + add (j) to [V v] + add ((i) + (1)) to [V v] + add (yy) to [V v] + add (j) to [V v] + add ((i) + (1)) to [V v] + add ((yy) + (1)) to [V v] + add (j) to [V v] + add (i) to [V v] + add ((yy) + (1)) to [V v] + add (j) to [V v] + add (cr) to [C v] + add (cg) to [C v] + add (cb) to [C v] + add [0] to [N v] + add [0] to [N v] + add [-1] to [N v] + change [yy v] by (1) + end + if <(j) = (7)> then + set [nh v] to (0) + else + set [nh v] to (item ((((i) * (8)) + (j)) + (2)) of [alt v]) + end + set [yy v] to (nh) + repeat ((hh) - (nh)) + if <(yy) = ((hh) - (1))> then + set [cr v] to ((134) * (0.62)) + set [cg v] to ((96) * (0.62)) + set [cb v] to ((67) * (0.62)) + else + set [cr v] to ((128) * (0.62)) + set [cg v] to ((128) * (0.62)) + set [cb v] to ((132) * (0.62)) + end + add (i) to [V v] + add (yy) to [V v] + add ((j) + (1)) to [V v] + add ((i) + (1)) to [V v] + add (yy) to [V v] + add ((j) + (1)) to [V v] + add ((i) + (1)) to [V v] + add ((yy) + (1)) to [V v] + add ((j) + (1)) to [V v] + add (i) to [V v] + add ((yy) + (1)) to [V v] + add ((j) + (1)) to [V v] + add (cr) to [C v] + add (cg) to [C v] + add (cb) to [C v] + add [0] to [N v] + add [0] to [N v] + add [1] to [N v] + change [yy v] by (1) + end + change [j v] by (1) + end + change [i v] by (1) +end +set [nf v] to ((length of [C v]) / (3)) +delete all of [PX v] +delete all of [PY v] +delete all of [PZ v] +repeat (4) + add [0] to [PX v] + add [0] to [PY v] + add [0] to [PZ v] +end +set [cx v] to (4) +set [cy v] to (7) +set [cz v] to (-5) +set [yaw v] to (0) +set [pit v] to (35) +set [mudou v] to (1) +forever + if then + change [yaw v] by (-5) + set [mudou v] to (1) + end + if then + change [yaw v] by (5) + set [mudou v] to (1) + end + if then + change [cy v] by (0.4) + set [mudou v] to (1) + end + if then + change [cy v] by (-0.4) + set [mudou v] to (1) + end + if then + change [pit v] by (-4) + set [mudou v] to (1) + end + if then + change [pit v] by (4) + set [mudou v] to (1) + end + if then + change [cx v] by (([sin v] of (yaw)) * (0.4)) + change [cz v] by (([cos v] of (yaw)) * (0.4)) + set [mudou v] to (1) + end + if then + change [cx v] by (((0) - ([sin v] of (yaw))) * (0.4)) + change [cz v] by (((0) - ([cos v] of (yaw))) * (0.4)) + set [mudou v] to (1) + end + if <(mudou) = (1)> then + set [mudou v] to (0) + reset timer + set [cs v] to ([cos v] of (yaw)) + set [sn v] to ([sin v] of (yaw)) + set [cp v] to ([cos v] of (pit)) + set [sp v] to ([sin v] of (pit)) + preencha a imagem (tela) com r (135) g (200) b (255) :: extension + delete all of [zb v] + repeat ((W) * (H)) + add [0] to [zb v] + end + set [f v] to (0) + repeat (nf) + set [b3 v] to ((f) * (3)) + set [b12 v] to ((f) * (12)) + set [vis v] to ((((cx) - (item ((b12) + (1)) of [V v])) * (item ((b3) + (1)) of [N v])) + ((((cy) - (item ((b12) + (2)) of [V v])) * (item ((b3) + (2)) of [N v])) + (((cz) - (item ((b12) + (3)) of [V v])) * (item ((b3) + (3)) of [N v])))) + if <(vis) > (0)> then + set [ok v] to (1) + set [k v] to (0) + repeat (4) + set [bb v] to ((b12) + ((k) * (3))) + set [dx v] to ((item ((bb) + (1)) of [V v]) - (cx)) + set [dy v] to ((item ((bb) + (2)) of [V v]) - (cy)) + set [dz v] to ((item ((bb) + (3)) of [V v]) - (cz)) + set [rx v] to (((dx) * (cs)) - ((dz) * (sn))) + set [rz v] to (((dx) * (sn)) + ((dz) * (cs))) + set [ry v] to (((dy) * (cp)) + ((rz) * (sp))) + set [rz v] to (((rz) * (cp)) - ((dy) * (sp))) + if <(rz) < (0.2)> then + set [ok v] to (0) + set [rz v] to (0.2) + end + replace item ((k) + (1)) of [PX v] with (((W) / (2)) + (((rx) * (F)) / (rz))) + replace item ((k) + (1)) of [PY v] with (((H) / (2)) - (((ry) * (F)) / (rz))) + replace item ((k) + (1)) of [PZ v] with ((1) / (rz)) + change [k v] by (1) + end + if <(ok) = (1)> then + set [fr v] to (item ((b3) + (1)) of [C v]) + set [fg v] to (item ((b3) + (2)) of [C v]) + set [fb v] to (item ((b3) + (3)) of [C v]) + set [tt v] to (0) + repeat (2) + set [ax v] to (item (1) of [PX v]) + set [ay v] to (item (1) of [PY v]) + set [az v] to (item (1) of [PZ v]) + set [bx v] to (item ((2) + (tt)) of [PX v]) + set [by v] to (item ((2) + (tt)) of [PY v]) + set [bz v] to (item ((2) + (tt)) of [PZ v]) + set [qx v] to (item ((3) + (tt)) of [PX v]) + set [qy v] to (item ((3) + (tt)) of [PY v]) + set [qz v] to (item ((3) + (tt)) of [PZ v]) + set [ar v] to ((((bx) - (ax)) * ((qy) - (ay))) - (((by) - (ay)) * ((qx) - (ax)))) + if <(ar) < (0)> then + set [tm v] to (bx) + set [bx v] to (qx) + set [qx v] to (tm) + set [tm v] to (by) + set [by v] to (qy) + set [qy v] to (tm) + set [tm v] to (bz) + set [bz v] to (qz) + set [qz v] to (tm) + set [ar v] to ((0) - (ar)) + end + if <(ar) > (0.01)> then + set [x0 v] to (maior entre (0) e ([floor v] of (menor entre (menor entre (ax) e (bx) :: operators) e (qx) :: operators)) :: operators) + set [x1 v] to (menor entre ((W) - (1)) e ([floor v] of (maior entre (maior entre (ax) e (bx) :: operators) e (qx) :: operators)) :: operators) + set [y0 v] to (maior entre (0) e ([floor v] of (menor entre (menor entre (ay) e (by) :: operators) e (qy) :: operators)) :: operators) + set [y1 v] to (menor entre ((H) - (1)) e ([floor v] of (maior entre (maior entre (ay) e (by) :: operators) e (qy) :: operators)) :: operators) + set [da v] to (((by) - (qy)) / (ar)) + set [db v] to (((qy) - (ay)) / (ar)) + set [pyy v] to (y0) + repeat (((y1) - (y0)) + (1)) + set [yc v] to ((pyy) + (0.5)) + set [xc v] to ((x0) + (0.5)) + set [wa v] to (((((bx) - (xc)) * ((qy) - (yc))) - (((by) - (yc)) * ((qx) - (xc)))) / (ar)) + set [wb v] to (((((qx) - (xc)) * ((ay) - (yc))) - (((qy) - (yc)) * ((ax) - (xc)))) / (ar)) + set [pxx v] to (x0) + set [row v] to (((pyy) * (W)) + (1)) + repeat (((x1) - (x0)) + (1)) + if <<(wa) > (-0.0001)> and <<(wb) > (-0.0001)> and <((wa) + (wb)) < (1.0001)>>> then + set [z v] to ((((wa) * (az)) + ((wb) * (bz))) + (((1) - ((wa) + (wb))) * (qz))) + if <(z) > (item ((row) + (pxx)) of [zb v])> then + replace item ((row) + (pxx)) of [zb v] with (z) + pinte a imagem (tela) em (pxx) , (pyy) com r (fr) g (fg) b (fb) :: extension + end + end + change [wa v] by (da) + change [wb v] by (db) + change [pxx v] by (1) + end + change [pyy v] by (1) + end + end + change [tt v] by (1) + end + end + end + change [f v] by (1) + end + erase all + desenhe (tela) em x (0) y (0) escala (5) :: pen + say (join [quadro em ] (join (timer) [ s])) + end +end