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 / Beginners problem with DBpro-Bitmaps and sprites

Author
Message
D258
19
Years of Service
User Offline
Joined: 22nd Feb 2005
Location:
Posted: 22nd Feb 2005 09:48
I have a book about darkbasic, but i am using dark basic pro.

and i have a bit of a problem already, when i do the load bitmap "file",0 i am able to display a bitmap on the screen, however when i use the load bitmap "file",1 use the get image command and set the sprite, nothing shows on the screen.

i tired to make this bitmap actually "move" while in the screen using the following code:

load image "c:\box.bmp",1
sync
wait key
for i=0 to i=100
sprite 1,i,i,1
next i
wait key

in the book i have, there is a command called SpritX(n) i tried using that to move the sprite but no luck in fact it gives me an error when i try to use the sprite x(1) command.

the only thing else i can add is the fact that when i use load bitmap "file",0 i do see the bitmap displayed on the screen, but i can't move it or anything.

oh yea, i will also need to use collision later on..

so any idea as to what i am doing wrong?
MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 24th Feb 2005 07:52 Edited at: 24th Feb 2005 08:06
1st:
Theres no Position Sprite command so heres a function that I use...


2nd:
when you use the Bitmap Screens you need to remember the command [Set Current Bitmap] which Sets the bitmap screen to be edited...
Ps: bitmap screen 0 is the main screen

3rd:
This code should work


4th:
SpriteX?
Try:
Sprite X(1) and Sprite Y(1)

5th
Sprite Collision...
I think theres a [Sprite Hit] Command
Or
Sprite Collision With Mouse


Hope this helps
Soy Cocktail
20
Years of Service
User Offline
Joined: 23rd Dec 2003
Location:
Posted: 24th Feb 2005 08:13
A problem that would always happen to me was I would froget to use the sync command. You have it before it goes into the for loop, but not inside the for loop. You probably need a sync or you should delete that extra sync command if you have it on auto screen updating, meaning it dosent just update when it hits a sync command. I assume that you want to be able to see the sprite move, since you didnt just posisition the sprite at 100x and 100y but had it move with a for loop.
try adding the command sync before the next i command.
it should look something like this


Aku Soku Zan
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 24th Feb 2005 18:34
i am using dark basic professional. I followed the book exactly to load a sprite and all i got was a black screen. however later i added set current bitmap o and the sprite showed up on the screen except the screen was blue now. Is that supposed to happen? Please look at my source and let me know if it is right. or what is wrong thank you.
MSon
20
Years of Service
User Offline
Joined: 13th Jul 2004
Location: Earth, (I Think).
Posted: 25th Feb 2005 02:19
The Code's not showing, but try the Following Command

That should fix it
smerf
19
Years of Service
User Offline
Joined: 24th Feb 2005
Location: nm usa
Posted: 25th Feb 2005 18:33
the sprite will load in demo version db but not in my dbpro. i tryed the backdrop code it set the background to black and the spite would not show. i have also tryed loading a background image to the screen then displaying the sprite but all i get is the background. the only way i have been get it to show is setting set current bitmap 0 but then the whole blue screen thing again . here is the code i have been using to display the sprite.
ty for your help. ps. is there a place i can go to get help on what all the buttons on the forum do.
walkman
19
Years of Service
User Offline
Joined: 27th Feb 2005
Location:
Posted: 27th Feb 2005 10:17
Try Set Current Bitmap 0 before the wait key line. I believe whenever you load or create a bitmap it stops writing to the screen and writes to the bitmap instead until you set the current bitmap back to 0.

Login to post a reply

Server time is: 2024-09-23 12:15:20
Your offset time is: 2024-09-23 12:15:20