0
加速度計を使用して文字を移動しようとしています。加速度計入力の取得 - Defold Engine
on_input()
の中にaction.acc_x/action.acc_y/action.acc_zを使用すると、他のアクションが実行されている場合にのみ情報を取得できます(「クリック」、「左」、「右」) )
私は唯一のデバイスの動きで文字を移動するには、スクリプトを変更したい
function on_input(self, action_id, action)
label.set_text("info#action", "action: ".. action_id)
label.set_text("info#info", "info: ".. tostring(action.acc_x) ..", ".. tostring(action.acc_y) ..", "..tostring(action.acc_z))
if action.acc_x > 0 then
self.player_direction.x = 1
elseif action.acc_x < 0 then
self.player_direction.x = -1
else
self.player_direction.x = 0
end
end
githubの:game.script