I am trying to use the event.pressure (https://docs.coronalabs.com/daily/api/event/touch/pressure.html) module, however, am having issues figuring out how it exactly works (as there is no sample code).
Basically, I want to make it so that when more pressure is applied on tap, an object is spawned in the taps position (3d touch on position spawns object).
Here's my code:
local function onTap(event) if spawnNum < 3 then if event.pressure == 2.0 then local object = display.newRect( event.x, event.y, 60, 20 ) object:setFillColor( 0, 0, 0 ) spawnNum = spawnNum + 1 end end end Runtime:addEventListener( "tap", onTap )
If anybody has any thoughts as to how to get this to work that'd be great.