javascript+css實現(xiàn)俄羅斯方塊小游戲
俄羅斯方塊,一個很有趣的一個小游戲,此次基于html+css+javaScript實現(xiàn),包含在一個方塊落地后自動生成方塊、操控方塊的移動以及方塊變形等。
部分代碼:
<!DOCTYPE html><html> <head> <meta charset='UTF-8' /> <title>俄羅斯方塊 — 經(jīng)典版V10</title> <link rel='stylesheet' href='http://www.gepszalag.com/bcjs/css/tetris.css' /> <style> .playground{ width: 525px; height: 550px; margin: 20px auto 0 auto; position: relative; background-image:url(../img/tetris.png); } .pause{width: 525px; height: 550px; position: absolute; top:0;left:0; background-image:url(../img/pause.png); z-index:100; display:none; } .playground img{ position:absolute;z-index:10;width:26px; } .playground p{ font-size: 30px; font-family: ’SimHei’; font-weight: bold; color: #667799; position: absolute; left:305px; top:120px; } .playground p+p{top:176px;} .playground p+p+p{top:232px;} </style> </head> <body> <div class='playground'> <p>SCORE:<span>0</span></p> <p>LINES:<span>0</span></p> <p>LEVEL:<span>1</span></p> </div> <script src='http://www.gepszalag.com/bcjs/js/shape.js'></script> <script src='http://www.gepszalag.com/bcjs/js/tetris.js'></script> </body></html>
游戲截圖:
源碼可參考:js俄羅斯方塊
更多有趣的經(jīng)典小游戲?qū)崿F(xiàn)專題,分享給大家:
C++經(jīng)典小游戲匯總
python經(jīng)典小游戲匯總
python俄羅斯方塊游戲集合
JavaScript經(jīng)典游戲 玩不停
javascript經(jīng)典小游戲匯總
以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. 三道java新手入門面試題,通往自由的道路--JVM2. 淺談XML Schema中的elementFormDefault屬性3. 基于javaweb+jsp實現(xiàn)學生宿舍管理系統(tǒng)4. ASP.NET MVC實現(xiàn)下拉框多選5. python requests模塊的使用示例6. ASP.NET MVC獲取多級類別組合下的產(chǎn)品7. 使用EF Code First搭建簡易ASP.NET MVC網(wǎng)站并允許數(shù)據(jù)庫遷移8. 關(guān)于HTML5的img標簽9. jsp中文亂碼問題的簡單解決方法10. ASP.NET MVC實現(xiàn)區(qū)域或城市選擇
