[Resolved] send shake signal

is there a way to send the shake signal sendable with command ?? [import]uid: 147322 topic_id: 26674 reply_id: 326674[/import]

I’m not totally sure what you are asking - what do you mean send it? [import]uid: 52491 topic_id: 26674 reply_id: 108295[/import]

you know if you press “command up” in the corona simulator. i want to know if you can put a piece of code in your game that sends the same command as “command up” (just for testing the game) [import]uid: 147322 topic_id: 26674 reply_id: 108309[/import]

I know command up simulates a shake - that’s why it is in there, because you cannot shake the simulator and may need to test :wink:

If your app, no, you can’t put code that forces the app to shake, if that is what you mean - because that is only triggered on device when a user shakes it.

I’m still not sure if I’m understanding 100% what you are trying to do, though - are you asking if you can get shake events on the device? [import]uid: 52491 topic_id: 26674 reply_id: 108445[/import]

sorry, i didnt write that top post too well. what i mean is like maybe

local function onShake( event )
print( “device shaken” )
end
Runtime:addEventListener( “shake”, onShake )

thats probably not what you would do, but id like to know how to do it. [import]uid: 147322 topic_id: 26674 reply_id: 108507[/import]

OH, I understand!

[lua]local function onShake (event)
if event.isShake then
print “Device was shaken”
end
end
Runtime:addEventListener(“accelerometer”, onShake)[/lua]

That will do it.

Peach :slight_smile: [import]uid: 52491 topic_id: 26674 reply_id: 108611[/import]

thanks! [import]uid: 147322 topic_id: 26674 reply_id: 108675[/import]