Collision bulletxEnemy - Endless Runner

O.O I need to finish this Endless runner untill this friday and i really really really need help of someone to create the collision of the enemies.

so right now i have this:

–this make the enemies move
function updateEnemies()
    inimigo1:toFront( )
    inimigo1.x = inimigo1.x - (speedenemy/20)
    physics.addBody( inimigo1, “static” )

    if(inimigo1.x <x1+100) then
        speedenemy =0
    end
    
end

–this make the bullet spawn
function spawnBullet()

    bullet = display.newRect( sprite1.x+120, sprite1.y+15, 30, 10 )
    bullet.name = ‘bullet’
    physics.addBody(bullet, “dynamic”, {bounce = 0})
    bullet.gravityScale = 0
    bullet.isBullet = true
    bullet:setLinearVelocity( 600, 0 )
    
end

how can i create an if inside it to check the collision of the bullet and the enemy?