Zmeika
How do I make an zmeika?
What is a zmeika? How do you make a zmeika? This script and codes were developed by Evgen Kaban on 07 January 2023, Saturday.
Zmeika - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Zmeika</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> </style></head><body>
<head> <meta charset="UTF-8"> <title>game</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>
<div class="game_zm"> <div id="div" class="game_zm_field"> <div class="game_zm_elem"></div> <div class="game_zm_elem_second"></div> </div>
</div>
</body> <script src="js/index.js"></script>
</body>
</html>
Zmeika - Script Codes CSS Codes
.game_zm{ background-color: #D0D0D0; position: relative; 0overflow: hidden;
}
.game_zm_field{ position: relative; position: absolute; background-color: #33CCFF; width: 400px; height: 400px; left: 100px; top: 100px; overflow: hidden; 0background-image: url(https://mail.sina.com.cn/images/index/springBg20160324.jpg);
0background-size: cover; 0background-attachment:fixed; 0background-position:center top;
}
.game_zm_elem{ position: relative; position: absolute; background-color: #CC66CC; width: 20px; height: 20px; border: 3px solid white; padding: 0px 0px 0px 0px; color: white; font-size: 25px; border-radius: 8px; left: 100px; top: 200px;
}
.game_zm_elem_second{ position: relative; position: absolute; background-color: yellow; width: 20px; height: 20px; border: 3px solid white; padding: 0px 0px 0px 0px; color: white; font-size: 25px; border-radius: 8px; left: 100px; top: 220px;
}
Zmeika - Script Codes JS Codes
var moving_zm_step = 20
var x_mous = 0;
var y_mous = 0;
var mouse_coord_go;
var target_x = 120;
var target_y = 0;
var position_game_zm_elem = $('.game_zm_elem');
var position_game_zm_second = $('.game_zm_elem_second');
$('.game_zm_field').mousemove(function(event){ x_mous = Math.round(event.offsetX==undefined?event.layerX:event.offsetX/20)*20; y_mous = Math.round(event.offsetY==undefined?event.layerY:event.offsetY/20)*20; //console.log(x_mous +'x'+ y_mous); //console.log(y_mous);
});
function moving_game_zm_second(second_x, second_y){ position_game_zm_second.css('top', second_x + 'px'); position_game_zm_second.css('left', second_y + 'px'); return;
}
function first_turn_left (turn_y){ turn_y -= moving_zm_step; position_game_zm_elem.css('left', turn_y + 'px'); return;
}
function first_turn_right (turn_y){ turn_y += moving_zm_step; position_game_zm_elem.css('left', turn_y + 'px'); return;
}
function first_turn_up (turn_x){ turn_x -= moving_zm_step; position_game_zm_elem.css('top', turn_x + 'px'); return;
}
function first_turn_bottom (turn_x){ turn_x += moving_zm_step; position_game_zm_elem.css('top', turn_x + 'px'); return;
}
function moving_game_zm_elem(){ var position_x = Math.round(position_game_zm_elem.position().top/10)*10; var position_y = Math.round(position_game_zm_elem.position().left/10)*10; var position_second_x = Math.round(position_game_zm_second.position().top/10)*10; var position_second_y = Math.round(position_game_zm_second.position().left/10)*10; if (x_mous){ target_x = y_mous; target_y = x_mous; } if (target_x-10 <= position_x && position_x <= target_x+10){ if (target_y-10 <= position_y && position_y <= target_y+10){return;}} if (position_x > target_x-20){ if(position_x-moving_zm_step == position_second_x){ moving_game_zm_second(position_x, position_y); if(position_y>target_y){ first_turn_left(position_y); }else{first_turn_right(position_y);} return; } moving_game_zm_second(position_x, position_y); position_x -= moving_zm_step; position_game_zm_elem.css('top', position_x + 'px'); return; } if (position_x < target_x){ if(position_x+moving_zm_step == position_second_x){ moving_game_zm_second(position_x, position_y); if(position_y>target_y){ first_turn_left(position_y); }else{first_turn_right(position_y);} return; } moving_game_zm_second(position_x, position_y); position_x += moving_zm_step; position_game_zm_elem.css('top', position_x + 'px'); return; } if (position_y > target_y1){ if(position_y-moving_zm_step == position_second_y){ moving_game_zm_second(position_x, position_y); if(position_x>target_x){ first_turn_up(position_x); }else{first_turn_bottom(position_x);} return; } moving_game_zm_second(position_x, position_y); position_y -= moving_zm_step; position_game_zm_elem.css('left', position_y + 'px'); return; } if (position_y < target_y){ if(position_y+moving_zm_step == position_second_y){ moving_game_zm_second(position_x, position_y); if(position_x>target_x){ first_turn_up(position_x); }else{first_turn_bottom(position_x);} return; } moving_game_zm_second(position_x, position_y); position_y += moving_zm_step; position_game_zm_elem.css('left', position_y + 'px'); return; }
}
//moving_game_zm_elem();
var moving_game_zm_elem_interval = setInterval(moving_game_zm_elem, 500)
Developer | Evgen Kaban |
Username | Evgen097 |
Uploaded | January 07, 2023 |
Rating | 3 |
Size | 2,569 Kb |
Views | 8,096 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
What we do 2 | 2,800 Kb |
Game_2 | 4,529 Kb |
A Pen by Evgen Kaban | 2,693 Kb |
CONTACT US | 2,905 Kb |
Menu | 3,657 Kb |
Slider 2.0 | 3,714 Kb |
Full sait | 5,615 Kb |
Showcase your | 3,087 Kb |
Bootstrap | 4,042 Kb |
Angular_templ_1 | 1,622 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Angular Sandbox | Alexgurrola | 1,616 Kb |
Static Image to Video Block | Grayghostvisuals | 4,864 Kb |
See Through | Larrygeams | 77,410 Kb |
Popup Modal | Aldlevine | 3,696 Kb |
Hoi hoi | JohnTheCat | 7,248 Kb |
Cant get enough icecream in pure css3 | Melawire | 4,322 Kb |
Opening Reveal Modal On Document Ready | Winghouchan | 1,787 Kb |
Mini Profile | Frytyler | 3,828 Kb |
Vertically rotating text with CSS | Nopr | 2,141 Kb |
Commuter Line Tokyu 8500 | Pedox | 7,031 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!