摇杆优化

This commit is contained in:
zhujunjie 2019-03-07 16:14:53 +08:00
parent cdd028cc68
commit e123aabdb4

16
gba/dist/gbajs.min.js vendored
View File

@ -7682,11 +7682,25 @@ window.vm = {
s.keyEvent(i, r ? "keydown" : "keyup", 0), e[r ? "addClass" : "removeClass"]("btn-on") s.keyEvent(i, r ? "keydown" : "keyup", 0), e[r ? "addClass" : "removeClass"]("btn-on")
}) })
}, },
onCtrlDire: function(t, e) { onCtrlDire: function(t, e) {
this.onCtrlDire; this.onCtrlDire;
var i = Math.round((t + 180) / 45) % 8; var i ;//= Math.round((t + 180) / 45) % 8;
var abst = Math.abs(t);
if((abst>=40&&abst<=50)||(abst>=130&&abst<=140)){
i = Math.round((t + 180) / 45) % 8;
}
else{
i = Math.round((t + 180) / 90) % 4*2;
}
this.oldDire != i && (e(i, t), this.oldDire = i) this.oldDire != i && (e(i, t), this.oldDire = i)
}, },
// onCtrlDire: function(t, e) {
// this.onCtrlDire;
// var i = Math.round((t + 180) / 45) % 8;
// this.oldDire != i && (e(i, t), this.oldDire = i)
// },
simulateKeyPress: function(t, e) { simulateKeyPress: function(t, e) {
var i = $.Event(e); var i = $.Event(e);
i.keyCode = t, i.which = i.keyCode, $(window).trigger(i) i.keyCode = t, i.which = i.keyCode, $(window).trigger(i)