Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6348127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:21:45+00:00 2026-05-24T21:21:45+00:00

I am working on a function to shoot multiple bullets here it is: local

  • 0

I am working on a function to shoot multiple bullets here it is:

local function shootBullets ( event )
    local bullet = display.newImageRect("images/Bullet.png", 12, 12) --Create the bullet image
    physics.addBody(bullet, "kinematic", {bounce = 0}) --Allow physics stuff to work on it
    bullets:insert( bullet ) --Add it to a global group called "bullets"
    bullet:setLinearVelocity(20, 40) --Give it a velocity

end

And I am calling it with this timer:

timer.performWithDelay(10, shootBullets)

It moves one bullet, but it isn’t making new ones. How can I have it spawn new bullets each time I call the shootBullets ( event )? I am not that familiar with Lua so sorry if I am doing something obviously wrong, or if I am not giving enough information (if you need more information, ask).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:21:46+00:00Added an answer on May 24, 2026 at 9:21 pm

    Oops, I should pay closer attention to the API:

    The default 3 parameter for timer.performWithDelay(time, function, times) is 1. To make it repeat forever I need to make it 0. So I changed:

    timer.performWithDelay(10, shootBullets)
    

    To this:

    timer.performWithDelay(10, shootBullets, 0)
    

    Now there are bullets.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have a working class or function to create the hashed email that
I'm having a lot of difficulty getting strophe's 'attach()' function working. I am working
the second function isnt working? $('.edit_hover').live('hover', function(e){ $(this).stop(); var half_width = ($(this).css('width').slice(0, -2))/2; var
I am working on a function to establish the entropy of a distribution. It
I was just working on a function that I needed to return two values,
i have this code $(function() { $('#ans_vote a span').click(function(){alert('working');return false;});}); and this html <div
I really need some help in Regular Expressions, i'm working on a function like
The function associated with the selector stops working when I replace it's contents using
Original Working VB_Code Private Declare Function ConnectReader Lib rfidhid.dll () As Integer Private Declare
I'm working on creating a call back function for an ASP.NET cache item removal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.