diff --git a/nikko/catgps_B.js~ b/nikko/catgps_B.js~ deleted file mode 100644 index 96f12c6..0000000 --- a/nikko/catgps_B.js~ +++ /dev/null @@ -1,136 +0,0 @@ -var piyo=L.icon({ - iconUrl:'piyopiyo.gif', - className:'piyoko', - iconSize:[30, 41], - iconAnchor:[19, 19], - popupAnchor: [-6, -10] -}); - -var piyo=L.icon({ - iconUrl:'piyopiyo.gif', - className:'piyoko', - iconSize:[30, 41], - iconAnchor:[19, 19], - popupAnchor: [-6, -10] -}); - -var piyoX=L.icon({ - iconUrl:'emoji_xx.png', - className:'piyoko', - iconSize:[30, 41], - iconAnchor:[19, 19], - popupAnchor: [-6, -10] -}); - -var ini=L.marker([38.97372749369379,139.94388515335632]).addTo(mymap); -function timeStart(){ - //console.log("unko"); - var res=confirm("okでゲームスタート!"); - if( res == true ) { - var time=setInterval(mk_cicle(time),180); - }else { - timeStart(); - } - //clearTimeout(circles); -}; - -function game(){ - - var timerInterval = 10000; // GPS失敗で何秒後に再取得か - var tmId = null; - var i = 0;//, countD = document.getElementById("countdown"); - - var point=L.marker(mymap.getCenter(),{icon:piyo,zIndexOffset:999}).addTo(mymap); - point.bindPopup("僕を安全なところにつれてって!").openPopup(); - var stop = document.getElementById("stp"); - - var gps=document.getElementById("str"); - var nowTrying = null; - var doflag=true; - - function tryGetGPS() { - clearTimer(); - //ser.textContent = "GPS取得..." - nowTrying = navigator.geolocation.getCurrentPosition( - onSuccess, onError,{ - maximumAge: 0, timeout: 1000, enableHighAccuracy: true}) - } - - function onemore() { - if (nowTrying || tmId) { - //info.textContent = "既にGPS取得試行or待機中です"; - } else { - startTimer(); - //tm.textContent=""+naiyo[0]+""; - } - } - - function startTimer() { - if (tmId==null && doflag){ - tmId = setTimeout(tryGetGPS, 1000); - //ser.textContent = "5秒後にGPS取得…"; - //tme.textContent= "周りに注意して使用しましょう!"; - } - } - - function clearTimer() { - if (tmId) { - clearTimeout(tmId); - //nowTrying=nil; - } - } - - function countDown(){ - if (doflag){ - alert("周りに注意して使用して下さい"); - tryGetGPS(); - timeStart(); - } else{ - tryGetGPS(); - doflag=true; - tmId=null; - } - } - - function stopCountDown() { - doflag=false; - } - - function onSuccess(pos) { - nowTrying = null; - tmId=null; - mymap.setZoom(5); - var latlng = L.latLng([pos.coords.latitude, pos.coords.longitude]); - - point.setLatLng(latlng); - mymap.panTo(latlng); - - var lat = latlng.lat, lng = latlng.lng; - - var g=1000000,d=0,i=0, come,name,near_point; - var dist=latlng.distanceTo(circle); - var dist=ini._latlng.distanceTo(circle); - var panco=panko[panko.length-1]; - - if(panco<=dist){ - onemore(); - }else if(dist<=panco){ - point.setIcon(piyoX).bindPopup("焼き鳥になっちゃったぴよー…").openPopup(); - alert("追いつかれちゃった…"); - stopCountDown(); - }else{ - point.bindPopup("助かったぴよー").openPopup(); - stopCountDown(); - } - } - - function onError(err) { // 失敗時 - nowTrying = null; - //ser.textContent = "現在位置の取得失敗.10秒後にもう一回"; - tmId = setTimeout(tryGetGPS, timerInterval); - } - - gps.addEventListener("click", countDown, false); - stop.addEventListener("click", stopCountDown, false); - }; -document.addEventListener("DOMContentLoaded", game, false); diff --git a/nikko/hai_gps.js~ b/nikko/hai_gps.js~ deleted file mode 100644 index d5bc21b..0000000 --- a/nikko/hai_gps.js~ +++ /dev/null @@ -1,92 +0,0 @@ -var mymap = L.map("mymap").setView([38.97391518054152,139.943252474086] , 18); -L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - attribution: - '© OpenStreetMap contributors' -}).addTo(mymap); - -var yama=[38.973621, 139.944348]; - -i=0; - -mymap.on("click", function(e){ - console.log(e.latlng); -}); - -var rad=0; -var panko=[],en=[]; -panko.push(rad); - -//var Panko=parseFloat(panko); - -var circle=[38.97391921076474,139.94443227720404]; - - - -function mk_cicle(cs){ - var time=setInterval(big,1000); - function big(){ - //r=r+50; - rad+=1; - panko.push(rad); - //console.log(panko); - var maru=L.circle(circle,{radius:panko[i],color:"red"}); - - en.push(maru); - en[i].addTo(mymap); - if(i==100){ - //clearTimeout(cs); - clearInterval(time); - clearInterval(cs); - //console.log(maru); - }else if(0OpenStreetMap contributors' -}).addTo(mymap); - -var yama=[38.973621, 139.944348]; - -i=0; - -mymap.on("click", function(e){ - console.log(e.latlng); -}); - -var rad=0; -var panko=[],en=[]; -panko.push(rad); - -//var Panko=parseFloat(panko); - -var circle=[38.97391921076474,139.94443227720404]; - - - -function mk_cicle(cs){ - var time=setInterval(big,1000); - function big(){ - //r=r+50; - rad+=1; - panko.push(rad); - //console.log(panko); - var maru=L.circle(circle,{radius:panko[i],color:"red"}); - - en.push(maru); - en[i].addTo(mymap); - if(i==100){ - //clearTimeout(cs); - clearInterval(time); - clearInterval(cs); - //console.log(maru); - }else if(0