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 / Bitmap background

Author
Message
NETMAN007
21
Years of Service
User Offline
Joined: 16th Jan 2003
Location: Malta
Posted: 16th Jan 2003 14:12
I have a problem relating to the LOAD Bitmap command.
I am writing this
Load bitmap "image.bmp"
load image "sprite1.bmp",1
sprite 1,0,0,1
Do
test1 = upkey()
if test1 = 1
move sprite 1,-3
endif
Loop

The problem is this that before I write the loop
the background will be as the bitmap image.
When I write the Do Loop with all the commands the bitmap dissapear and the background would be blue.
Someone help please!
VietStylist
22
Years of Service
User Offline
Joined: 20th Sep 2002
Location: Australia
Posted: 16th Jan 2003 14:58
Well, you have to draw the bitmap every loop of the program. A "BITMAP" in DB would be better refered to as "image data in memory allocated for offscreen drawing operations". This is very useful for drawing radars or progress meters that required you to draw stuff that would not show on screen at first and retrieving what you have drawn and pasting it onscreen. It's sort of hard for me to explain. Anyway, just don't use db's bitmaps for simple stuff like this. Either use sprites if the image is going to be animated, or images if it is static.

What I suggest you would do is load the background image as a image and paste it everyloop. As for moving the sprite in the do-loop: don't you think you can simplify it down? Anyway, here's my substitution of your code:

rem ---------
rem You should use these commands for a faster and smoother program execution
sync on
sync rate 60

load image "image.bmp",100 : rem Set a range for different types of images
load image "sprite1.bmp",1
sprite 1,0,0,1

do

rem Paste the background
paste image 100,0,0

rem Simplified sprite movement
if upkey()=1 the move sprite 1,3
if downkey()=1 the move sprite 1,-3

sync:loop
rem ----------

Sorry, if that confused you a bit, but I hope it helps.

Vs

333 Mhz , 96 mb ram , 15 inch monitor , intergrated intel810 graphics chipset ...
BBoy VietStylist 1.9k'86

Login to post a reply

Server time is: 2024-11-23 21:50:12
Your offset time is: 2024-11-23 21:50:12