Results 1 to 5 of 5

Thread: How to run two instances of the same function???

  1. #1

    Thread Starter
    Hyperactive Member toughcoder's Avatar
    Join Date
    Nov 2002
    Location
    Near, Very Near
    Posts
    340

    How to run two instances of the same function???

    Hello every1,
    I'm making a clone of arkanoid. Now when a brick is hit, apowerup falls down. The powerup reached half way, when another brick is hit and another powerup falls down. I wanna know, how can i manage both the powerUp?? How achieve this. Have i made myself clear.
    If Not VB Then Exit
    ------------------------------------------------
    visit me @ http://mzubair.50g.com/

  2. #2
    Addicted Member
    Join Date
    Jun 2002
    Location
    Far.. far away! (Netherlands)
    Posts
    169
    Create an array for all the powerups.

  3. #3
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860

    Ahh. and I thought you meant recursion

    You`ll need an array, as one varaible can`t be two things at once.
    Ex:

    VB Code:
    1. dim x(0 to 4)
    2. sub command1_click(llallala)
    3. x(0) = 1
    4. x(1) = x*2
    5. x(2) = 3
    6. x(3) = x(3)+1
    7. x(4) = 24
    8. for a = 0 to 4
    9. msgbox x(a)
    10. next a
    11. end sub
    Don't pay attention to this signature, it's contradictory.

  4. #4
    Fanatic Member Mushroom Realm's Avatar
    Join Date
    Mar 2002
    Location
    Murrieta, California
    Posts
    650
    Instead of having it to be preset in the For statement use a static variable. Then you can make it increment with each hit, and decrement when the powerup hits the bottom(you will still need an array, this just allows you to have more than 5 like in the example).

  5. #5
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    I was just giving an example of how variable arrays could be used in case he didn't know what they were.
    Don't pay attention to this signature, it's contradictory.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width