XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

How would a remove a 2d billboard?

Last post 6/2/2009 9:07 PM by Katianie. 3 replies.
  • 6/2/2009 12:43 PM

    How would a remove a 2d billboard?

    Hey there
    I have a guy that shoots bullets
    However!
    These bullets go on forever  and i would like to know how to remove them!
    I store them in an array btw
  • 6/2/2009 1:05 PM In reply to

    Re: How would a remove a 2d billboard?

    What does your bullet creation code look like?

    You'll want to do something like this:
    class Bullet 
        //add this 
        int TimeFired; 
     
    //when creating a bullet: 
    bullets[i].TimeFired = System.Environment.TickCount; 
     
    //when updating the bullets: 
    if(System.Environment.TickCount > bullets[i].TimeFired + 1000) 
        bullets[i].Alive = false

    I can be more specific if I have more code to work with.
    "Software is never finished, it is in varying states of 'less broken'" because "If it ain't broke, it doesn't have enough features yet"

    In Playtest: Avatar Land | The MANLY Game for MANLY Men

    The signature that was too big for the 512 char limit
  • 6/2/2009 4:19 PM In reply to

    Re: How would a remove a 2d billboard?

    Wouldn't it be better to work with the gameTime supplied to Update() rather than ticks, or killing them after they have travelled a certain distance?
    Game hobbyist hell-bent on coding a diabolical Matrix
  • 6/2/2009 9:07 PM In reply to

    Re: How would a remove a 2d billboard?

    I think the easyest way to do it would be if you had a timer for your bullet object and when that timer = a certan number then stop drawing it or remove it from the array
Page 1 of 1 (4 items) Previous Next
var gDomain='m.webtrends.com'; var gDcsId='dcschd84w10000w4lw9hcqmsz_8n3x'; var gTrackEvents=1; var gFpc='WT_FPC'; /*<\/scr"+"ipt>");} /*]]>*/
DCSIMG