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.

DarkBASIC Professional Discussion / Can anyone tell me why this code doesn't work?

Author
Message
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 15th Apr 2010 23:57
It's from a book on Dark Basic Programming and it also has Pro code.
This code is supposed to load a background in then put a sprite of an F15 on the background. All it does is show the background.

I have had the book for years. The code from the disk doesn't work either.

Here is the code. This may be DBC code. It is a DBA file.



Dragonslayer
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 16th Apr 2010 00:01
Try this:



The fastest code is the code never written.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Apr 2010 00:15
That code doesn't work for me either.

Try this. It works for me using U7.5beta11.

Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 16th Apr 2010 00:27
OK Hawkblood
That code did the same thing as my code but it shrunk the background image so you could see the blue screen and didn't show the F15.


Green Gandalf

That code worked the way it should! I am guessing it has something to do with the sync commands. These commands were not in the book code or in the code on the CD.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 16th Apr 2010 00:29
Taking another look, if you try to Get Image from bitmap 1, then you will not see anything. I investigated it and here is what I came up with. It's a little different:


and you will be able to get image 1 as well. Just looking at your post doesn't give me a complete picture of what you are trying to accomplish, so I have to guess.

The fastest code is the code never written.
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 16th Apr 2010 00:38
That code shows the the F15 on the blue screen. What this code is trying to do is load an image in to be used as a background and load the sprite on top of the background image.
Hawkblood
16
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 16th Apr 2010 00:42


How's this?

The fastest code is the code never written.
Dragon slayer
19
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 16th Apr 2010 00:47
That worked. Now I need to study both codes to find out why. I commented out the sync commands in Green Gandalf's code and it only showed an F15 on the blue screen and your code worked fine so there is more than one way to do this.
basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 16th Apr 2010 18:43
you will have to set the bitmap screen to zero.
use the statement: set current bitmap 0

Login to post a reply

Server time is: 2026-07-26 14:30:48
Your offset time is: 2026-07-26 14:30:48