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)
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)
O_o
Stop drawing the image that represents the star?
Soma
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
O_o
We aren't communicating.
Maybe try to find a forum in your native language.
Soma
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= >*
Gun, explosion. You've just drawn them both.Code:`o= X
Gun. That's all you draw.Code:`o=
Quzah.
Hope is the first step on the road to disappointment.
i have started coding in SDL , so i upload images of gun ,star ,bullet instead of drawing , anyway thanks for the new concept
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.
It's nothing to do with SDL, it's purely your internal data.
Eg.
The decision to draw (or not) is not dependent on the thing you actually use to do the drawing.Code:if ( bullet.x != star.x && bullet.y != star.y ) { // drawSomethingUsingSDL } else { // some other stuff }
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.