Snake web game code

Snake web game code

Snake web game code

<style>
::selection {
color:#FFFFFF;
background:transparent;
}
::-moz-selection {
color:#FFFFFF;
background:transparent;
}
* {
margin:0;
padding:0;
font-family:"VT323";
}
body {
background-color:#000000;
}
.wrap {
margin-left:auto;
margin-right:auto;
}
header {
width:340px;
font-size:0;
}
canvas {
display:none;
border-style:solid;
border-width:10px;
border-color:#FFFFFF;
}
canvas:focus {
outline:none;
}
/* Top Styles */
h1 {
display:inline-block;
width:100px;
font-size:32px;
color:#FFFFFF;
}
.score {
display:inline-block;
width:240px;
font-size:20px;
color:#FFFFFF;
text-align:right;
}
.score_value {
font-size:inherit;
}
/* All screens style */
#gameover a,#setting a,#menu a {
display:block;
}
#gameover a,#setting a:hover,#menu a:hover {
cursor:pointer;
}
#gameover a:hover::before,#setting a:hover::before,#menu a:hover::before {
content:">";
margin-right:10px;
}
/* Menu Screen Style */
#menu {
display:block;
width:340px;
padding-top:95px;
padding-bottom:95px;
font-size:40px;
margin-left:auto;
margin-right:auto;
text-align:center;
color:#FFF;
}
#menu h2 {
-webkit-animation:logo-ani 1000ms linear infinite;
animation:logo-ani 1000ms linear infinite;
margin-bottom:30px;
}
#menu a {
font-size:30px;
}
@-webkit-keyframes logo-ani {
50% {
-webkit-transform:scale(1.3,1.3);
}
100% {
-webkit-transform:scale(1.0,1.0);
}
}@keyframes logo-ani {
50% {
transform:scale(1.3,1.3);
}
100% {
transform:scale(1.0,1.0);
}
}/* Game Over Screen Style */

#gameover {
display:none;
width:340px;
padding-top:95px;
padding-bottom:95px;
margin-left:auto;
margin-right:auto;
text-align:center;
font-size:30px;
color:#FFF;
}
#gameover p {
margin-top:25px;
font-size:20px;
}
/* Settings Screen Style */
#setting {
display:none;
width:340px;
margin-left:auto;
margin-right:auto;
padding-top:85px;
padding-bottom:85px;
font-size:30px;
color:#FFF;
text-align:center;
}
#setting h2 {
margin-bottom:15px;
}
#setting p {
margin-top:10px;
}
#setting input {
display:none;
}
#setting label {
cursor:pointer;
}
#setting input:checked + label {
background-color:#FFF;
color:#000;
}
</style>
</head>
<body><script src="/demos/googlegg.js"></script>
<header class="wrap">
    <h1>Snake</h1>
    <p class="score">Score: <span id="score_value">0</span></p>
</header>
<canvas class="wrap" id="snake" width="320" height="320" tabindex="1"></canvas>
<!-- Game Over Screen -->
<div id="gameover">
    <h2>Game Over</h2>
    <p>press <span style="background-color: #FFFFFF; color: #000000">space</span> to begin a</p>
    <a id="newgame_gameover">new game</a>
    <a id="setting_gameover">settings</a>
</div>
<!-- Setting screen -->
<div id="setting">
    <h2>Settings</h2>
    <a id="newgame_setting">new game</a>
    <p>Speed:
        <input id="speed1" type="radio" name="speed" value="120" checked/>
        <label for="speed1">Slow</label>
        <input id="speed2" type="radio" name="speed" value="75" />
        <label for="speed2">Normal</label>
        <input id="speed3" type="radio" name="speed" value="35" />
        <label for="speed3">Fast</label>
    </p>

贪吃蛇网页小游戏代码是一款简单黑白风格好玩的在线网页小游戏特效。

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

js Snake web version game special effects code sharing (challenge ten levels)_javascript skills js Snake web version game special effects code sharing (challenge ten levels)_javascript skills

16 May 2016

This article mainly introduces the special effects of the js Snake web version. The game has ten levels in total. It is recommended to everyone. Friends in need can refer to it.

Web page special effects code Web page special effects code

22 Aug 2019

Web page special effects are a technology that uses program code to implement special effects or special functions in web pages. Web page scripts (javascript, vbscript) are used to write codes to create dynamic special effects.

Share a snake special effects code implemented in html5 Share a snake special effects code implemented in html5

04 May 2017

In this article, the editor will share with you a simple snake special effects code implemented in html5. Friends who like it can take a look.

Share an example of special effects code that simulates static web page paging Share an example of special effects code that simulates static web page paging

16 Jun 2017

Special effects code that simulates static paging.

Web advertising special effects code sharing Web advertising special effects code sharing

21 Aug 2017

The editor below will bring you a simple example of web advertising special effects. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.

Imitation of Sohu women's channel FLASH picture switching effect_image special effects Imitation of Sohu women's channel FLASH picture switching effect_image special effects

16 May 2016

When using it, you can refer to some other special effects on this site.

How to implement image and video special effects in C++? How to implement image and video special effects in C++?

26 Aug 2023

How to implement image and video special effects in C++? With the development of modern science and technology today, image and video special effects play an important role in entertainment, advertising, education and other fields. As a powerful programming language, C++ provides many tools and libraries for processing images and videos. This article will introduce how to implement image and video special effects in C++ and provide some code examples. 1. Image special effects to realize image reading and saving. To realize image special effects, you first need to read and save images. There are many image processing libraries in C++ such as OpenCV and

Describe Canvas combined with JavaScript to achieve picture special effects Describe Canvas combined with JavaScript to achieve picture special effects

07 Mar 2018

We all know that canvas is in HTML5. Canvas can make many special effects and other magical things. Of course, JavaScript can also do it. But have you ever played with canvas and JavaScript to achieve image special effects? If not, let’s take a look!

How to use Vue to implement digital animation special effects How to use Vue to implement digital animation special effects

21 Sep 2023

How to use Vue to implement digital animation special effects Preface: In web applications, digital animation special effects are often used to display statistical data, countdowns, or other scenes that need to highlight the effects of digital changes. As a popular JavaScript framework, Vue provides rich data binding and transition animation functions, which is very suitable for realizing digital animation special effects. This article will introduce how to use Vue to implement digital animation special effects and provide specific code examples. 1. Set initial data: First, we need to set a variable in the Vue component

See all articles See all articles

Hot Tools

jQuery+Html5 realizes beautiful confession animation code

jQuery+Html5 realizes beautiful confession animation code

jQuery+Html5 implements beautiful confession animation code, the animation effect is great, a must-have for programmers to confess!

Couple's romantic confession js special effects code

Couple's romantic confession js special effects code

JS special effects code for couples' romantic confession. Such special effects can be used on wedding photography websites or placed on personal websites. It is also a good special effect. PHP Chinese website recommends downloading!

Simple js love confession artifact

Simple js love confession artifact

Simple native js love confession artifact

Bunker's html5 particle animation expressive effects

Bunker's html5 particle animation expressive effects

Bunker's html5 particle animation expression special effects code, the animated special effects text can be changed in the code, you can make a page where you can customize text input, it should be very popular, this HTML5 special effect is very beautiful.

jQuery responsive background login interface template

jQuery responsive background login interface template

jQuery responsive backend login interface template html source code. The login page uses jquery to verify the form and determine whether the username and password meet the requirements. Usually the login page is a page that must be used on corporate websites or mall websites. Responsive backend pages, When the browser zooms in or out, the background will resize the image according to the browser! PHP Chinese website recommends downloading!

Hot Article

Luma Island: How To Get Tool Tokens
14 Nov 2024 Mobile Game Guide
Supervive: Hudson Build Guide
30 Nov 2024 Mobile Game Guide
Where to get a Psi Protection Suit in Stalker 2
28 Nov 2024 Mobile Game Guide