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! / Load bitmap

Author
Message
Vinnie
22
Years of Service
User Offline
Joined: 1st Jun 2004
Location: Chicago, ILL
Posted: 1st Jun 2004 17:34
Is there something wrong with this code?

I can't get the images to display together. One transparent and the other the background.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 1st Jun 2004 18:13
LOAD bitmap "background.bmp",2


Change that....


LOAD bitmap "background.bmp"

Get rid of the 2

Vinnie
22
Years of Service
User Offline
Joined: 1st Jun 2004
Location: Chicago, ILL
Posted: 1st Jun 2004 18:19
This still doesn't work. It only displays one bitmap.



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

`Load background bitmap
LOAD bitmap "background.bmp"

`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


`Wait for keypress
WAIT KEY

END
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 1st Jun 2004 18:51 Edited at: 1st Jun 2004 18:53
I ran it, and it grabbed the sprite, and put it on the background. What were you hoping it would do? The second bitmap is the sprite image. Maybe you are not using black 0,0,0 around the sprite image.

Vinnie
22
Years of Service
User Offline
Joined: 1st Jun 2004
Location: Chicago, ILL
Posted: 1st Jun 2004 18:54
What I would like it to do is...............display the background and display the airplane image as well.

Vince
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 1st Jun 2004 18:56
It should work. Your airplane image must be messed up. Or parhaps it is not 300 pixels wide or something.

Vinnie
22
Years of Service
User Offline
Joined: 1st Jun 2004
Location: Chicago, ILL
Posted: 1st Jun 2004 19:03
All I get is the background showing up. The image has black around it and it is 300x300. I just don't understand. Is it because I am using DBPRO? Or am I just stupid.

Please help


Vince
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 1st Jun 2004 20:15
I use DB Classic. I thought that showing sprites was the same.

Vinnie
22
Years of Service
User Offline
Joined: 1st Jun 2004
Location: Chicago, ILL
Posted: 1st Jun 2004 20:19
Hmmmmmmmmmmm............I guess not, maybe there is another way of doing this.

I just can't figure it out.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Jun 2004 23:06
When you load a bitmap, that bitmap becomes the current bitmap - that means that all drawing is done to that bitmap until you reset the current bitmap.

Once you've loaded the bitmap and grabbed the image, just use the following command to switch back to the display bitmap:

SET CURRENT BITMAP 0

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Vinnie
22
Years of Service
User Offline
Joined: 1st Jun 2004
Location: Chicago, ILL
Posted: 1st Jun 2004 23:10
Then the way that is in the book is not correct then? Thank you for clarifying that.



Vince
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Jun 2004 00:58
The book is for DBC and there are some differences when using it for DBPro. As I understand it, pretty much everything else should work the same - at least no-one has had other problems with the book code that I'm aware of.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
DWman
21
Years of Service
User Offline
Joined: 23rd Jun 2004
Location:
Posted: 26th Jun 2004 12:47
Runtime Error 506 could not load image at line 4
The picture i drew in paint and saved it as a bmp

Dave W
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 26th Jun 2004 14:36
You can take the get image line out. You don't get an image after loading an image.

SandraD
22
Years of Service
User Offline
Joined: 30th May 2004
Location: Down on the corner, out in the street.
Posted: 2nd Jul 2004 06:44 Edited at: 2nd Jul 2004 06:52
If you are using DBC, load the airplane image FIRST, then grab it, and then load the background....

This seems to be a bug in DBC, in that loads go to the screen and thus the background is lost. In other words;

load bitmap "f15.bmp"
get image 1, 0, 0, 300, 300

load bitmap "background.bmp"

Sprite 1, 170, 90, 1

this should work....
S.

[edit] Hmm. an edit cause by Zenassem's 2D tutorial, in that load image is not the same as load bitmap. Load bitmap I know goes to the screen if not directed to another, which I use to load my sprite images. Load image, while loading, does not set itself as the current bitmap, which can cause get image problems. But load bitmap (at least in my DBC experience) works best going to the screen, so the above should function for you as well...
s.

Any truly great code should be indisguishable from magic.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Jul 2004 09:09 Edited at: 2nd Jul 2004 09:09
Load Image is better than Load Bitmap, because it is less lines of code.

Login to post a reply

Server time is: 2026-06-09 19:41:00
Your offset time is: 2026-06-09 19:41:00