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 / Why no sprite visible?

Author
Message
Sir Spaghetti Code
20
Years of Service
User Offline
Joined: 12th Jul 2004
Location: Just left of Hell
Posted: 24th Jul 2004 00:44
Hello all! I am working out of the Beginner's Guide to DarkBASIC Programming, and I am on chapter 11. I was working on the TransSprite example (to show transparencies in sprites), and I could not get the sprite to be visible. All I get is the background. I have loaded the "F15.bmp" and "background.bmp" into the project folder, but still, no sprite! I have included the source code. Please Help!

P.S.- I am using DBpro!
Sir Spaghetti Code
20
Years of Service
User Offline
Joined: 12th Jul 2004
Location: Just left of Hell
Posted: 24th Jul 2004 05:31
Is my computer screwed up? what's going on?
Sir Spaghetti Code
20
Years of Service
User Offline
Joined: 12th Jul 2004
Location: Just left of Hell
Posted: 24th Jul 2004 08:01
Anybody have any ideas? Sorry for the noob ?, but I am really getting a little discouraged with DB. I write the code exactly as it is on the book (I check it about ten times!), but it is still not wroking correctly. Is it my computer, or is has there been some updates to DBpro that are making the book examples not work correctly?
SandraD
20
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 24th Jul 2004 10:47
Just for the fun of it.. try including the redundant command of;

show sprite 1

after the sprite command. You should not be required to do this, but what the hey...
S.

Any truly great code should be indisguishable from magic.
Bean
20
Years of Service
User Offline
Joined: 23rd Mar 2004
Location: Flower Mound Texas
Posted: 25th Jul 2004 14:41
Try the following code out -
If you have any additional questions,please post.
The book was written primarily for DBC and their are some differences with the way sprites are handled.
This is really frustrating to someone that is just starting out...
believe me, I have been there!
mezron
20
Years of Service
User Offline
Joined: 12th Jul 2004
Location:
Posted: 26th Jul 2004 15:28
I was using the same book and after some research I found I had to use this command: (try and see if it helps)

set current bitmap 0

What you have to remeber is the sprite command puts them on whatever bitmap is you active bitmap so if you have loaded others etc you'll have to manually switch it back them use the sprite command or just copy the bitmap they where put on to bitmap 0 (screen)

Hope this helps let me know

pizzaman
20
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 26th Jul 2004 22:54 Edited at: 26th Jul 2004 22:59
The problem here is the code delete the following line of code and it should work

get image 1,0,0,300,300

Basically what the code was saying was load an image into image slot 1, then get an image from the screen and store it in image slot 1, hence overwriting the image previously loaded with the image of a section of the current screen, therefore the background image.

The correct code should be



You might be wondering why there is an extra 1 at the end of the load image command - this is to turn off mipmapping so the image isn't blurred on your sprite; if you use the get image command you should also do this.

Also I have to say the book was written for DBC so some examples won't work - this one was coded wrongly though, it shouldn't work in DBC either.

pizzaman

Login to post a reply

Server time is: 2024-09-22 18:21:22
Your offset time is: 2024-09-22 18:21:22