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 Displaying Sprites ô¿ô

Author
Message
Yekoms
19
Years of Service
User Offline
Joined: 6th Dec 2005
Location: Deep inside FUNCTION BlueSkys
Posted: 13th Dec 2005 14:12
I'm confussed.
I'm in Chapter 11 of the Beginners Guide to DarkBasic, the chapter on sprites and I can't get it to display like the book said is should. see (1) in # 1 all I get is a black screen.
If I add it( where the book said to, which is before the "load bitmap "F15.bmp",2", I only get a black screen. see (2)
However
If I move it to after the "sprite 1,179,90,1" then I get the sprite on a blue screen. see (3)
I am yet to get the sprite and the background to show at the same time.
Thanks,
Confussed in Cyberspace

Source Code below.

Keep'em Movin
comando 300
21
Years of Service
User Offline
Joined: 23rd Nov 2003
Location:
Posted: 13th Dec 2005 21:04
Use the source code box.

Yekoms
19
Years of Service
User Offline
Joined: 6th Dec 2005
Location: Deep inside FUNCTION BlueSkys
Posted: 13th Dec 2005 21:43
I thought I did. Here it is again. I'll write it here and in the code snippet
From Chapter 11
1)- Original Code
hide mouse
cls
load bitmap "F15.bmp",1
get image 1,0,0,300,300
sprite 1,179,90,1
wait key
end
** only get a black screen
` then it said to add the line " load bitmap "background.bmp",0
2)- Original Code
hide mouse
cls
load bitmap "background.bmp",0
load bitmap "F15.bmp",1
get image 1,0,0,300,300
sprite 1,179,90,1
wait key
end
** I get the background but no sprite

However If I move the "load bitmap "background.bmp",0 to the line below the get image 1,0,0,300,300 line I get the sprite on a blue screen.[see 3)-]in code area. Or if i put a "set current bitmap 0" after the get image or the sprite line I get the sprite on a blue background. I can't seem to get the sprite infront of the background.

Keep'em Movin
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 13th Dec 2005 22:46 Edited at: 13th Dec 2005 22:47
Code snips are when you type this (without the spaces). The source doesn't work for people still in a newbie slap (every message needs to be verifed as ok by a mod before being seen by everybody).

[ code ]
Your code goes here.
[ /code]

It's because you're using Darkbasic Pro. All sprites in Pro (because of the DirectX) are actually 3D plains so you see the blue background because it's a 3D object.

Bitmap 0 is the screen. All other bitmap numbers are there but not seen automatically. To do a background in Pro you have to paste the image to the background. Since you're only using one single image for that bitmap use "load image" instead. This combines both the loading of the picture and the getting of the image at the same time.

It's also better to use "sync" in Pro. You must set the speed with "sync rate" and turn it on with "sync on"... once you do that everytime the computer sees "sync" it updates the screen.




Yekoms
19
Years of Service
User Offline
Joined: 6th Dec 2005
Location: Deep inside FUNCTION BlueSkys
Posted: 14th Dec 2005 16:31
Thanks. That seem to be the problem. So, DarkBasic Pro's sprites are displayed in 3D? Must remember that.
I also had to add the (sync) under the (sync on) line to get it to work.
Thanks again for the help.

Keep'em Movin

Login to post a reply

Server time is: 2025-05-16 07:05:10
Your offset time is: 2025-05-16 07:05:10