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.

2D All the way! / Problem with displaying sprites

Author
Message
iac249
21
Years of Service
User Offline
Joined: 26th Mar 2003
Location: USA
Posted: 13th Apr 2003 22:13
I grabbed this code out of the "Beginner's Guide to DarkBASIC Game Programming", but it is not working in DBPro. It displays the background, but the sprite is not appearing. What's wrong?

`Initialize the program
SET DISPLAY MODE 640, 480, 32
HIDE MOUSE
CLS

`Load background bitmap
LOAD BITMAP "background.bmp", 0

`Load the source bitmap file
LOAD BITMAP "F15.bmp", 1

`Grab image 1 from bitmap
GET IMAGE 1,0,0,300,300

`Draw the sprite
SPRITE 1,170,90,1
paste sprite 1, 0, 0

`Wait for keypress
WAIT KEY

END
iac249
21
Years of Service
User Offline
Joined: 26th Mar 2003
Location: USA
Posted: 13th Apr 2003 23:37
Well, after much difficulty, I figured it out. It appears some of the "DBPro" examples in the book don't work, at least in SP4. Here's how I changed the code:

`Initialize the program
SET DISPLAY MODE 640, 480, 32
HIDE MOUSE
CLS

`Load background bitmap
LOAD IMAGE "background.bmp", 1
PASTE IMAGE 1, 0, 0

`Load the source bitmap file
LOAD IMAGE "F15.bmp", 2

`Draw the sprite
SPRITE 1, 170, 90, 2
SET SPRITE 1, 1, 1

`Wait for keypress
WAIT KEY

END

Login to post a reply

Server time is: 2024-04-18 20:41:19
Your offset time is: 2024-04-18 20:41:19