Hi,
I had a quick question on my code and how I can make it work.
My ultimate goal is to make it so that each time the user taps the block moves up and to a different size on each tap. For example, on tap 1 the block moves up and to the left, then on tap 2 it moves up and to the right, then tap 3 goes back to the left, etc.
My idea to make this work is to have a number count, and when the number is 1 it will move left/up on tap, and when it is 0 it will move right/up on tap.
Right now my code is working, but not to my liking. Right now I have the block moving upwards on touch on the screen, but for some reason it will not work on tap.
If somebody can help me out with this to complete those tasks that would be great.
Thanks!
local block = display.newRect( 100, 100, 20, 20 ) block:setFillColor( 0, 0, 0) block.rotation = 45 block.x = centerX block.y = centerY block.isFixedRotation = true physics.addBody( block, { friction=1.0, density=1.0, bounce=0.3, radius=35 } ) local function onTap( event ) if event.phase == "began" then block:applyForce( 0, -1000, block.x, block.y ) end return true end Runtime:addEventListener( "touch", onTap )