Help Having Enemies bullet shoot more than once!

Hi. Ok I have this game were I have this enemy that go across the screen in portrait. While the enemy goes across it shoots. What I got so far is the enemy shooting, but only once. Here is the code

[code] local function enemies3 ()
local enem3 = display.newRect(0,0, 100, 100)
enem3.y = math.random(30, 290)
enem3.x = 600
enem3.isFixedRotation = true
enem3.isSensor = true
physics.addBody (enem3, {bounce=0.6})
transition.to (enem3, {time = 5000, x=-50})
enem3.hit = “enem3”
enem3.hits = 0
localGroup:insert(enem3)
local badtwin = display.newRect(0,0, 10, 10)
badtwin.x = enem3.x - 40
badtwin.y = enem3.y

badtwin.hit = “badtwin”
physics.addBody (badtwin, {bounce=0.6})
localGroup:insert(badtwin)
local function shootmorebad ()
transition.to (badtwin, {time = 1000, x= - 50})

end
badshoot1 = timer.performWithDelay(1, shootmorebad, -1)
end

timer3 = timer.performWithDelay(math.random (1000, 5000), enemies3, -1)[/code]

What I try to do is have the enemy shoot more than once, but I’am struggling with that. This code is also plug and play but it goes in portrait. [import]uid: 17058 topic_id: 22656 reply_id: 322656[/import]

Your baddy takes 1000ms to move across the screen
time = 1000, x= - 50})

The bullet moves across the screen once every 1000 to 5000ms.
timer3 = timer.performWithDelay(math.random (1000, 5000)

If you want more than one bullet in the 1000ms you will need a shorter time for it. [import]uid: 10389 topic_id: 22656 reply_id: 90345[/import]

@Waulok thanks I actually modified it a little bit by just adding a function for spawning the bullets it looks like this

[code]local function enemies3 ()
local enem3 = display.newImageRect(“enem3.png”, 50, 80)
enem3.y = math.random(30, 290)
enem3.x = 600
enem3.isFixedRotation = true
enem3.isSensor = true
physics.addBody (enem3, {bounce=0.6})
transition.to (enem3, {time = 5000, x=-50})
enem3.hit = “enem3”
enem3.hits = 0
localGroup:insert(enem3)
local function shootbad ()
local badtwin = display.newImageRect(“bullet.png”, 10, 10)
badtwin.x = enem3.x - 40
badtwin.y = enem3.y

badtwin.hit = “badtwin”
physics.addBody (badtwin, {bounce=0.6})
localGroup:insert(badtwin)
transition.to (badtwin, {time = 2000, x= - 100})
badshoot1 = timer.performWithDelay(1, shootmorebad, -1)
end
bad = timer.performWithDelay(1000, shootbad, -1)
end
timer3 = timer.performWithDelay(math.random (1000, 5000), enemies3, -1) [/code]

Thanks again [import]uid: 17058 topic_id: 22656 reply_id: 90350[/import]