Thread: Want a help

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    4

    Want a help

    I am making a shooting space game in C using SDL graphics where a gun shoot star approaching it , i am confuse how can we make star disspeapear(i upload star as a bmp image) when it is hitted by bullet (which is also a bmp image)

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    Stop drawing the image that represents the star?

    Soma

  3. #3
    Registered User
    Join Date
    Feb 2012
    Posts
    4
    you mean i have to just put * for star instead of image? again how can i dissappear it? please help me , as i am beginner

  4. #4
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    O_o

    We aren't communicating.

    Maybe try to find a forum in your native language.

    Soma

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    `o=            *
    Gun, star. You've just drawn them both.
    Code:
    `o=           *
    Gun, star. You've just drawn them both.
    Code:
    `o=          *
    Gun, star. You've just drawn them both.
    Code:
    `o=<       *
    Gun firing, star. You've just drawn them both.
    Code:
    `o= >     *
    Gun, bullet, star. You've just drawn them all.
    Code:
    `o=  >   *
    Gun, bullet, star. You've just drawn them all.
    Code:
    `o=   > *
    Gun, bullet, star. You've just drawn them all.
    Code:
    `o=    >*
    Gun, bullet, star. You've just drawn them all.
    Code:
    `o=    X
    Gun, explosion. You've just drawn them both.
    Code:
    `o=
    Gun. That's all you draw.


    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    Registered User
    Join Date
    Feb 2012
    Posts
    4
    i have started coding in SDL , so i upload images of gun ,star ,bullet instead of drawing , anyway thanks for the new concept

  7. #7
    Registered User
    Join Date
    Feb 2012
    Posts
    4
    i think we should apply the logic if the coordinate of bullet and star is equal then dissappear star image but i don't know how to do that in SDL , so please help.

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    It's nothing to do with SDL, it's purely your internal data.
    Eg.
    Code:
    if ( bullet.x != star.x && bullet.y != star.y ) {
      // drawSomethingUsingSDL
    } else {
      // some other stuff
    }
    The decision to draw (or not) is not dependent on the thing you actually use to do the drawing.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed