Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How do I display a sprite on top of a background?

Author
Message
Geoff
17
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Sheffield (U.K.)
Posted: 15th Jul 2007 12:38
I have got two *.bmp's.
1) a background (about half screen size)
2) a red ball surrounded by black (for a transparent sprite)
I have really tried to display the ball on the background, but without success so far.
How can do this, please?
Geoff
Geoff
17
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Sheffield (U.K.)
Posted: 15th Jul 2007 18:56
Thank you, WindowsKiller.
The ball does now appear on the background (a snooker table).

But:-
1) It appears as my original bitmap. That is, a black rectangle holding a red ball (i.e. it's not transparent).
2) The outline of the ball is no longer true. It is very jagged.

I have used this ball bitmap as a sprite in Liberty Basic and Visual Basic6 (boo!) and it works o.k.
Any ideas, please?
Geoff
Geoff
17
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Sheffield (U.K.)
Posted: 15th Jul 2007 23:32
I think that I have now attached my bitmap (it's my first attachment).
I created it myself in MS Paint program using the ellipse/circle tool.

Attachments

Login to view attachments
Geoff
17
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Sheffield (U.K.)
Posted: 16th Jul 2007 18:46
No, I copied and pasted your code snippet. The only changes I made were the names of my two bmp files.
This is a shot in the dark, but I have noticed that the jagged ball image which my program displays is approximately 1.3 times bigger than when I view it in Paint.
Is their any relevance in the fact that I have my resolution set at 800 X 600?
Geoff
Geoff
17
Years of Service
User Offline
Joined: 10th Jul 2007
Location: Sheffield (U.K.)
Posted: 17th Jul 2007 18:04
Thank you, I have now got a transparent sprite appearing on the background.
I am now going to work on the ball.bmp in the hope of getting its edges smooth.
I may be back.
Geoff

Login to post a reply

Server time is: 2024-09-27 02:24:51
Your offset time is: 2024-09-27 02:24:51