Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tetris = [showgui tetris]
- append = [$arg1 = (concat (getalias $arg1) $arg2)]
- _tetris_clearrows = [
- loop i 20 [[_tetris_row@i] = ""]
- ]
- _tetris_genrows = [
- _tetris_clearrows
- looplist i $_tetris_static [
- cond (< $i 10) [
- append _tetris_row0 $i
- ] (< $i 100) [
- append _tetris_row@(substr $i 0 1) (substr $i 1 1)
- ] (< $i 200) [
- append _tetris_row@(substr $i 0 2) (substr $i 2 1)
- ]
- ]
- ]
- _tetris_i = "-4 -5 -6 -7"
- _tetris_j = "-14 -15 -16 -6"
- _tetris_l = "-13 -14 -15 -3"
- _tetris_o = "-15 -16 -5 -6"
- _tetris_s = "-15 -16 -4 -5"
- _tetris_t = "-15 -16 -17 -6"
- _tetris_z = "-14 -15 -5 -6"
- _tetris_static = "" // coords that have settled down
- _tetris_active = "" // active block coords
- _tetris_newpos = "" // coords used for boundary measurements
- _tetris_valid = 1
- _tetris_cleared = 0
- _tetris_clearrows
- // TEMP STUFF //
- test = [say STATIC: $_tetris_static / ACTIVE: $_tetris_active / NEWPOS: $_tetris_newpos]
- guicondbutton = [
- guibutton (concatword (? $arg1 $arg2 $arg3) $arg4) (
- ? $arg1 $arg5 (? (= $arg6 1) $arg5 $arg6)
- ) (? $arg1 $arg7 (? (= $arg8 1) $arg7 $arg8))
- ]
- rndo = [at $arg1 (rnd (listlen $arg1))]
- // TEMP STUFF //
- newgui tetris [
- guistayopen [
- guilist [
- guilist [
- loop i 20 [
- guilist [
- loop p 10 [
- guicondbutton (
- || [> (listfind z $_tetris_active [= $z (concatword $i $p)]) -1] [
- > (indexof $_tetris_row@i $p) -1
- ]
- ) "" "" "" [
- _tetris_row@i = (listdel $_tetris_row@i @p)
- ] [
- append _tetris_row@i @p
- ] "radio_on" "radio_off"
- ]
- ]
- ]
- ]
- guistrut 2
- guilist [
- guibutton "Spawn Block" [
- _tetris_active = $_tetris_@(rndo "i j l o s t z") // spawn random block
- ]
- guibutton "Move Down" [
- if (listlen $_tetris_active) [
- _tetris_newpos = ""
- _tetris_valid = 1
- _tetris_cleared = 0
- //-----------------------
- looplist p $_tetris_active [ // calculate new coords
- append _tetris_newpos (+ $p 10)
- ]
- looplist i $_tetris_newpos [ // check move-down conditions
- if (|| [> $i 199] [> (indexof $_tetris_static $i) -1]) [_tetris_valid = 0]
- ]
- if $_tetris_valid [_tetris_active = $_tetris_newpos] [ // move block to new coords
- _tetris_static = $_tetris_active // move block coords to static
- _tetris_active = "" // clear active block
- _tetris_genrows // generate row hits
- loop i 20 [
- if (= (listlen $[_tetris_row@i]) 10) [
- _tetris_cleared = (+ $_tetris_cleared 1) // compute rows cleared
- _tetris_row@i = "" // clear full row
- ]
- ]
- // continue with moving STATIC above a cleared row, below. work on scoring tech.
- ]
- ]
- ]
- ]
- ]
- ]
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement