Bob le bricoleur

PEUT IL LE FAIRE ???
master
orphevs 2017-12-08 21:25:32 +01:00
parent 50982ed04a
commit 8b13b4d6ce
7 changed files with 43 additions and 100 deletions

View File

@ -0,0 +1,43 @@
function move(event) {
var k = event.keyCode,
chrId = document.querySelector('.test'),
chrId = document.querySelector('.alderiate'),
chr = {
updown: function () {
var y = parseInt(getComputedStyle(chrId).top);
if (k == 38) {
y -= 10;
if ( y == -10 ){
y += 10;
}
} else if (k == 40) {
y += 10;
if ( y == 410 ){
y -= 10;
}
}
return y;
},
leftright: function () {
var x = parseInt(getComputedStyle(chrId).left);
if (k == 37) {
x -= 10;
if ( x == -10 ){
x += 10;
}
} else if (k == 39) {
x += 10;
if ( x == 910 ){
x -= 10;
}
}
return x;
}
};
chrId.style.top = (chr.updown()) + "px";
chrId.style.left = (chr.leftright()) + "px";
}
document.addEventListener('keydown', move);

View File

@ -1 +0,0 @@
# de_tank

View File

@ -1,39 +0,0 @@
body{
margin: 0;
padding: 0;
font-family: sans-serif;
background: #232323;
}
.header{
text-align: center;
}
.header h1{
display: inline-block;
font-size: 42px;
padding-top: 15px;
padding-bottom: 20px;
color: #fff;
}
.map{
width: 1170px;
height: 658px;
border: solid 3px red;
background: url(../img/bg_sand.png) repeat;
position: absolute;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
}
.block{
height: 20px;
width: 20px;
background: green;
position: absolute;
left: 50px;
top: 50px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

View File

@ -1,43 +0,0 @@
function move(event) {
var k = event.keyCode,
chrId = document.querySelector('.test'),
chrId = document.querySelector('.alderiate'),
chr = {
updown: function () {
var y = parseInt(getComputedStyle(chrId).top);
if (k == 38) {
y -= 10;
if ( y == -10 ){
y += 10;
}
} else if (k == 40) {
y += 10;
if ( y == 410 ){
y -= 10;
}
}
return y;
},
leftright: function () {
var x = parseInt(getComputedStyle(chrId).left);
if (k == 37) {
x -= 10;
if ( x == -10 ){
x += 10;
}
} else if (k == 39) {
x += 10;
if ( x == 910 ){
x -= 10;
}
}
return x;
}
};
chrId.style.top = (chr.updown()) + "px";
chrId.style.left = (chr.leftright()) + "px";
}
document.addEventListener('keydown', move);

View File

@ -1,17 +0,0 @@
<html>
<head>
<meta charset="UTF-8">
<title>de_tank</title>
<link rel="stylesheet" href="./assets/css/style.css">
</head>
<body>
<section class="header">
<h1>de_tank</h1>
</section>
<section class="map">
<div class="block"></div>
</section>
</body>
<script src="assets/js/script.js"></script>
</html>