wheel joint problem to move

Hi All,

     I am using wheel joint to develop a game but i have a problem for how to move a car,please need help,below i attached code

display.setStatusBar( display.HiddenStatusBar )

require “physics”

–require “gameUI”

physics.start()

physics.setDrawMode(“hybrid”)

–Determine Device Size

local disw = display.contentWidth

local dish = display.contentHeight

local car_body = display.newRect(40, 0, 95, 20)

car_body:setFillColor(100,75,75)

local car_rear_wheel = display.newCircle( 20, 30, 15 )

local car_front_wheel = display.newCircle( 60,30,15 )

car_rear_wheel:setFillColor(25,128,25)

car_front_wheel:setFillColor(25,25,200)

local floor = display.newRect(disw/2, dish-10, disw+100,20 )

–Apply The Physics

physics.addBody(floor,“static”, {friction=0.5})

physics.addBody(car_body,{density=100,friction=0,bounce=0})

physics.addBody(car_rear_wheel,{density=100,friction=1,bounce=0,radius=15})

physics.addBody(car_front_wheel,{density=100,friction=1,bounce=0,radius=15})

local rearShock = physics.newJoint(“wheel”, car_body, car_rear_wheel, car_rear_wheel.x, car_rear_wheel.y, 0, -20)

local frontShock = physics.newJoint(“wheel”, car_body, car_front_wheel, car_front_wheel.x, car_front_wheel.y, 0, -20)

rearShock.isMotorEnabled=true

frontShock.isMotorEnabled=true

  – rearShock.maxMotorTorque = 1

  –   frontShock.maxMotorTorque = 1

    local applyMotorSpeed = false

    local motorSpeed

    – define the touch listener for the screen

    local function onScreenTouched(event)

        – get the touch location

        if event.phase == “began” then

            – here we check where the touch location took place

            – if it was on the left of the screen, we set the motorSpeed value to -5, otherwise it is on the right, so set the motorSpeed to 5

            if event.x < display.contentCenterX then motorSpeed = -5

            else motorSpeed = 5

            end

            – allow the application of the motor speed

            applyMotorSpeed = true

        elseif event.phase == “ended” then

            – disable application of the motor speed

            applyMotorSpeed = false

        end

    end

    – define the update function that is called every frame

    local function update(event)

        – if we are allowed to apply the motor speed to the pivot joints, then do it!

        if applyMotorSpeed then

            rearShock.motorSpeed = rearShock.motorSpeed + motorSpeed

            frontShock.motorSpeed =frontShock.motorSpeed + motorSpeed

        end

    end

    – define the event listeners for updating and screen touch

    Runtime:addEventListener(“touch”, onScreenTouched)

    Runtime:addEventListener(“enterFrame”, update)

Thanks,

Karthik