Random Bounceing Balls

Discussion in 'iOS Programming' started by Seza, Nov 9, 2009.

  1. Seza macrumors newbie

    Joined:
    Nov 9, 2009
    #1
    Hey

    I started with an app where I need to use a random function of the random number of balls bouncing around at the screen. So each lvl are there a random number of balls are bounceing around hope there are some who wants to help me. Thanks in advanced Seza


    The code: .m http://pastebin.com/f487d7a8d .h http://pastebin.com/fbb2d114
     
  2. dukeofism macrumors member

    Joined:
    Jul 22, 2009
    #2
    What aspect of the code do you need help with? No one can help you if you don't tell them what troubles you are encountering.
     
  3. Seza thread starter macrumors newbie

    Joined:
    Nov 9, 2009
    #3
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
  5. Seza thread starter macrumors newbie

    Joined:
    Nov 9, 2009
    #5
    I want to add a random function, so each lvl has a random number of ball baounceing around at the screen. I Dont know how i should code this random function ? :(
     
  6. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    This is the very first search result for random on the iPhone Developer Center. Was that really so hard?
     
  7. Kingbombs macrumors member

    Joined:
    Jun 24, 2009
    #7
    you use arc4random() at the top where you #define
    are you using someone else's code and not understanding it?
     
  8. Seza thread starter macrumors newbie

    Joined:
    Nov 9, 2009
    #8
    I Want some help with an function so every time at each lvl there should be a random number of balls bounceing around. I dosent know how to make that random function code, i want some help to write that code. Thanks In advanced :p
     
  9. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #9
    Code:
    long numberOfBalls = random();
    There. How's that? ;)
     
  10. Seza thread starter macrumors newbie

    Joined:
    Nov 9, 2009
    #10
    Thanks but where should i write it ? :) Where in the code ? :)
     
  11. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #11
    In the code that is the start of each level.
     

Share This Page