[問題] 非動畫相關 BBS-lua ?

看板BBSmovie作者時間16年前 (2008/01/06 22:04), 編輯推噓11(1107)
留言18則, 11人參與, 最新討論串1/1
不知道po在這邊是不是恰當 有一個問題 剛剛在批兔的版上看到一個用"bbs-lua"寫的貪食蛇 按下大P就真的開始在BBS上玩貪食蛇 讓我覺得很神奇 這跟動畫功能的指令好像不一樣 不知道是從哪冒出來的 而且轉來批萬就無效了 很好奇 不知有沒有人知道這東西的相關事情 以下是我看到的文章 (批萬不能執行的樣子) 請按大寫 P --#BBSLUA snake={{x=20,y=12}} -- snake body snakelen = 3 score = 0 dir={x=1, y=0} target=nil duration=0.2 miny = 1 maxy = 24 minx = 0 maxx = 40 function drawSnake(m, t) local i bbs.color(1,33) for i = 1, table.getn(m) do bbs.move(m[i].y, m[i].x*2) bbs.outs('▉') if (i == 1) then bbs.color(0,33) end end bbs.color(1,31) bbs.move(target.y, target.x*2) bbs.outs('★') -- prevent stupid terminal clients sending double keys bbs.move(target.y, target.x*2+1) end function hitSnake(m, y, x) local i if y < miny or y >= maxy then return 1 end if x < minx or x >= maxx then return 1 end for i = 1, table.getn(m) do if (m[i].y == y) and (m[i].x == x) then return 1 end end return nil end function hitTarget(y, x) if y == target.y and x == target.x then return 1 end return nil end function drawGameOver() bbs.clear() bbs.move(12, 30) print([[G A M E O V E R]]); end function nextTarget(m) local t t = {} repeat t.y = math.random(maxy-miny)-1+miny t.x = math.random(maxx-minx)-1+minx until not hitSnake(m, t.y, t.x) return t end target = nextTarget(snake) repeat -- draw all bbs.clear() bbs.title('BBS-Lua 貪食蛇 範例 (按 END 或 Ctrl-C 中斷) 分數: ' .. score .. " ") drawSnake(snake) bbs.refresh() if bbs.kbhit(duration) then c = bbs.getch() if c == 'UP' then dir.x = 0; dir.y = -1; end if c == 'DOWN' then dir.x = 0; dir.y = 1; end if c == 'RIGHT' then dir.x = 1; dir.y = 0; end if c == 'LEFT' then dir.x = -1; dir.y = 0; end if c == 'END' then break; end end -- update snake local o, n o = snake[1] n = {} n.x = o.x + dir.x n.y = o.y + dir.y if (hitSnake(snake, n.y, n.x)) then -- gameover drawGameOver() break end -- ok to increase length table.insert(snake, 1, n) while table.getn(snake) > snakelen do table.remove(snake, snakelen+1) end if (hitTarget(n.y, n.x)) then -- hit target, increase length score = score + 100 snakelen = snakelen + (score / 100) * 3 target = nextTarget(snake) end until false --#BBSLUA -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.62.229.133

01/06 22:04, , 1F
P1還沒實裝 就算有也是一年或半年後吧XD
01/06 22:04, 1F

01/06 22:04, , 2F
而且很難當作動畫使用 這需要技術上的突破了XD
01/06 22:04, 2F

01/06 22:05, , 3F
啊 我覺得這真是很酷^^""
01/06 22:05, 3F

01/06 22:06, , 4F
這個都還在測試當中, 不保證未來會實裝 囧"
01/06 22:06, 4F

01/06 22:15, , 5F
感覺是BBS小遊戲系列@@
01/06 22:15, 5F

01/06 22:19, , 6F
我去P2玩了...0.0 有人有注意到這條蛇可以加速爆走嗎XD
01/06 22:19, 6F

01/06 22:22, , 7F
一直換方向嗎?
01/06 22:22, 7F

01/06 22:29, , 8F
一直按著前進方向 就會狂跑
01/06 22:29, 8F

01/06 23:19, , 9F
請問去哪裡有呀
01/06 23:19, 9F

01/06 23:20, , 10F
Ptt2《BBSLua》版
01/06 23:20, 10F

01/06 23:22, , 11F
喔喔 找到了 thank you
01/06 23:22, 11F

01/06 23:35, , 12F
這是程式嘛...哇靠 百聞不如一見 已經有了唷@@ 去看看 ~
01/06 23:35, 12F

01/07 01:57, , 13F
那個尾巴長長的比例根本在欺負人嘛XDDDD
01/07 01:57, 13F

01/07 15:01, , 14F
水啦 之後遊戲都用BBSLua寫了 可惜ptt還要等 @@
01/07 15:01, 14F

01/08 20:25, , 15F
...這篇勾起我學java的痛苦回憶...囧rz
01/08 20:25, 15F

01/09 12:56, , 16F
Java好食啊!
01/09 12:56, 16F

01/11 20:27, , 17F
轉文章記得附作者及出處喔~~
01/11 20:27, 17F

01/20 11:47, , 18F
喔 因為第一次看到的時候也是別人轉錄的 作者被消去了@@
01/20 11:47, 18F
文章代碼(AID): #17WD_KQ4 (BBSmovie)