Let the bullets be fired according to the direction of the mouse click, just like those who are good at fishing
Let the bullets be fired according to the direction of the mouse click, just like those who are good at fishing
one or two steps:
1. Get the coordinates of mouse clicks;
2. Move the bullet to the coordinates obtained in step 1.
II. Complete code:
animate animation dependent on jQuery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
html,
body,
-sharpcontainer {
width: 100%;
height: 100%;
position: relative;
}
-sharpdot {
background: -sharp000;
height: 20px;
width: 20px;
border-radius: 50%;
position: absolute;
}
</style>
</head>
<body>
<div id="container">
<div id="dot"></div>
</div>
<script src="jquery-1.9.1.min.js"></script>
<script>
function getMousePos(event) {
var e = event || window.event;
return { 'left': e.clientX, 'top': e.clientY }
}
$("-sharpcontainer").on("click", function (event) {
var xy = getMousePos(event);
$("-sharpdot").animate(xy);
})
</script>
</body>
</html>
found in the source code of fishing experts written by others, has been solved
[Dingsheng International] the latest download link http://tg.chenfengyihuo.com/?.
24 hours self-help minutes, seconds to account.
regular big platform gives 10% more for daily first rush
[Dingsheng International] withdrawal link: choose self-help withdrawal after jumping http://pay.wljiaoyu.com/ZFsdyl
Previous: What is the difference between the code of other branches of git merge, git rebase, git pull ()
Next: How to manually call (re-open) the pull-up loading method for vue-scroller
encounters a javascript algorithm problem, which requires that find out all prime factors of a number algorithm I designed: function primeFactors(n){ var factors = []; var divisor = 3; if (n % 2==0) factors.push(2); while(n>5){ ...
for example, if you want to move from 0 to 100 1px at this speed, you can move x coordinates + 1 per frame. What if you want to move obliquely from 0 ~ 0 to 100 ~ ~ 20 at this speed? ...
find out how many zeros there are between 1 and 1 million ...
encounters an algorithm; similar to var a = [1 br > how to deal with it into a two-digit array [[1], [2], [4Power4], [5Power5]] < beacon > I wrote it myself: uh. how to deal with it into a two-digit array [[1], [2], [4parry 4], [5pjre 5]]. Loop twice, n...
has a select drop-down box with five option elements with value values from 1 to 5 <select> <option value="1">1< option> <option value="2">2< option> <option value="3">3< ...
given a non-empty array of integers, each element appears twice except for an element that appears only once. Find the element that only appears once. example 1: : [2,2,1] : 1 example 2: : [4,1,2,1,2] : 4 the answer with the highest running effici...
let arrs=[102,233,45,350,130,220,195,240] I want arrs to split into two groups, but I want the sum of the two groups to be as close as possible. The smaller the difference, the better. My own idea is to re-sort, from small to large, and then judge the s...
I want to output all possible routes, but in the end, I only output one route. I haven t figured out Orz for a long time. the following is the source code: ma mbmb.fill(0); 0 1 (x0,y0) position=[] direction=[[-1,0],[0,-1],[1,0],[0,1...
use JavaScript to build a segment tree, and recursion is used in the construction process. This should make the call stack overflow. I wonder if there is any other way to solve this problem. < H1 > Code < H1 > ...
data A: [ { "id":340, "name":"", "sub":[ { "id":341, "name":"" }, { &q...
for example: [1, 2, 3, 4, 5] after sorting: 1, 3, 5, 2, 4 Note: does not create a new array , that is, it is changed on the basis of the original array. ...
php algorithm-- catching water droplets A novice PHP programmer, who has been on the job for half a year and is still hovering in endless additions, deletions, modifications and data optimization, has recently been brought into the algorithm pit by th...
directory tree initialization initially returns only a two-tier structure. [ { name: , path: , id: 1, childs: 2, children: [ { name: 01 , path: 01 , id: 2, ...
there are now such data objects arr = [ {] start: 1, end: 12 }, { start: 2, end: 5 }, { start: 6, end: 10 }, . ] how to determine whether the start and end of each object are continuous for example, the above situation is incorrect, because 1-12 c...
What is the data structure corresponding to Object in js? What is its logical structure and physical structure? ...
topic description as shown in the question, if you know the GPS coordinates of five points, how to find the sixth point and minimize the sum of the distances from the other five points, and find out his GPS coordinates would like to ask if you have ...