V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
爱意满满的作品展示区。
setimouse

周末手撸的 JS 俄罗斯方块

  •  1
     
  •   setimouse · Jul 22, 2024 · 2437 views
    This topic created in 651 days ago, the information mentioned may be changed or developed.

    周末闲着无聊,想起初中时总想自己做一个俄罗斯方块但终没有做成,不能留遗憾,于是动手开撸了。 不到 300 行代码,几个小时写出来了。 年少时觉得难以翻越的山丘,如今早已没有什么难度了。

    点击看成果: https://setimouse.github.io/js-tetris/

    github 地址: https://github.com/setimouse/js-tetris

    1. Clone this project
    2. Open index.html in your browser.
    3. Follow me: https://x.com/pekingmuge

    Tetris

    8 replies    2024-07-25 08:56:55 +08:00
    dianso
        1
    dianso  
       Jul 22, 2024
    我觉得还是这个 UI 好看

    https://chvin.github.io/react-tetris
    body007
        2
    body007  
       Jul 23, 2024
    @dianso 这个项目也不错,总结了很多经验啊。
    LavaC
        3
    LavaC  
       Jul 23, 2024
    失算了啊
    LavaC
        4
    LavaC  
       Jul 23, 2024

    不知道为啥不让我直接发
    duan602728596
        5
    duan602728596  
       Jul 23, 2024
    有个 bug ,如果在边缘变形的时候,可能会出现一部分在边缘外的情况
    setimouse
        6
    setimouse  
    OP
       Jul 23, 2024
    @LavaC 左边缘溢出已经修改了。DAS,ARR,SRS 学习了,zan!
    NNNNzs
        7
    NNNNzs  
       Jul 25, 2024
    既然你放在全局作用域,就别怪我不客气了

    function newTetromino() {
    return new Tetromino(tetrominos[6]);
    }
    setimouse
        8
    setimouse  
    OP
       Jul 25, 2024
    @NNNNzs 哈哈哈
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2897 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 09:10 · PVG 17:10 · LAX 02:10 · JFK 05:10
    ♥ Do have faith in what you're doing.