-
Notifications
You must be signed in to change notification settings - Fork 0
/
index-start.html
128 lines (104 loc) · 2.43 KB
/
index-start.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title>Titre</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
<style>
p {
font-family: "Comic Sans", "Courier", sans-serif;
}
.snowflakes {
top:0px;
left:0px;
position:absolute;
z-index:200;
font-size: 3em;
width:10px;
height:10px;
background:;
}
body {background-color:white;}
#site {
width:100vw;
height:100vh;
margin:0 auto;
position:relative;
overflow:hidden;
}
#plus{
top:0px;
left:0px;
position:absolute;
z-index:200;
font-size: 5em;
width:10px;
height:10px;
background:;
}
#debug {
position: absolute;
right: 0px;
bottom: 0px;
min-width: 150px;
min-height: 50px;
border : 1px solid black;
}
</style>
</head>
<body>
<div id="site">
<div id="snowZone">
<div id="plus">+</div>
<div id="debug"></div>
<div class="personnage"><img src="personnages/DOG.1.png"></div>
</div>
</div>
<p>Welcome to</p>
<p>Moreless+</p>
<p>press enter</p>
<p>to play</p>
<script src="jquery.js"></script>
<script src="fleches.js"></script>
<script>
// variables
var cntSt = 0, cntSi = 0;
snowX = Math.floor(Math.random() * $('#site').width());
limite = $(window).height();
pixels = 8.0;
function doStuffwTimeout(){
setTimeout(function(){
// Position de départ (axe horizontal)
$('#plus').css({'left':snowX+'px'});
if(cntSt < limite){
// on ajoute un pixel
cntSt = cntSt + pixels;
$('#plus').css('top', cntSt);
// info de debug
// currentPos = $('#plus').offset();
// $("#debug").html("left: " + currentPos.left + "<br>top: " + currentPos.top);
// et on répète!
doStuffwTimeout();
} else {
// fin!
// collision avec le personnage?
cntSt = 0;
snowX = Math.floor(Math.random() * $('#site').width());
// on accélère...
if (pixels<10){
pixels = pixels + 0.2;
}
// et on recommence!
doStuffwTimeout();
}
},16); // vitesse: 16 millisecondes, càd 1/60.
}
// Lancement au chargement
$(window).on('load',function() {
doStuffwTimeout();
});
</script>
</body>
</html>