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.

Author
Message
timer help
12
Years of Service
User Offline
Joined: 14th Jan 2014
Location:
Posted: 13th Feb 2014 19:09
Hello, I am trying to get my bitmap to work in this quiz I have. I know this is probably very easy but I'm new to dark basic. Here is my code:


I am basically trying to make it so if you lose it displays an image, and if you win it displays a different image. I also want an image that is displayed while your answering the questions in the quiz.
ShellfishGames
13
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 13th Feb 2014 19:28 Edited at: 13th Feb 2014 19:31
You should probably check out the commands load image and paste image.

A simple example of how to use them:



load image can load bmp, jpg, png and more (I believe tiff, tga and gif as well, but I never really use them).

In case you want to do more with those images in the game (such as changing their appearance in real time - e.g. rescaling them, changing their color or transparency etc.), you might check out sprites. But for now basic images should be just what you need.

Furthermore, the set image colorkey command might be of interest to you if you want your images to have transparent parts. Also note the comment at the "paste image" line from the code above in that case.

timer help
12
Years of Service
User Offline
Joined: 14th Jan 2014
Location:
Posted: 18th Feb 2014 18:58
@Shellfish
I tried your code and this is what it looks like:



I get the same error. "Could not determine parameter type of 'mouse y()'

the "images.bmp" is my image that I selected.
TFE
20
Years of Service
User Offline
Joined: 1st Oct 2005
Location: Sweden
Posted: 18th Feb 2014 19:29
Try removing the space in mouse y() to "mousey()"

Same routine every day: sleep today, work tomorrow
ShellfishGames
13
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 18th Feb 2014 20:11
Oh, sorry about that. Stupid typos. But as TFE said, changing "mouse y()" to mousey() should do the job.

timer help
12
Years of Service
User Offline
Joined: 14th Jan 2014
Location:
Posted: 20th Feb 2014 18:56 Edited at: 20th Feb 2014 18:57
After trying out the code, it almost worked but it just went to a black screen:



This is where I put it:


If you run the code, the screen just goes black. What do I do?
ShellfishGames
13
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 20th Feb 2014 21:01
Just tried your code and it works here. I used an image from my hard drive, and after pressing x as the game tells me I get to a screen where this image is drawn to the mouse coordinates. If you just see a black screen, maybe something's wrong with your image, I don't know.
The only thing I could think of is that your image a) is either really huge so the program needs some time to load it, or b) your image is... well... black.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Feb 2014 16:58 Edited at: 21st Feb 2014 17:06
I don't know about the rest of your code but this part from an earlier post works fine:



I suggest you build your code one step at a time so when you move from something that works to something that doesn't you will have a clearer idea where to look.

Edit Just tested the long version of your code and that works fine too. I pressed H when prompted and saw the image being moved around the screen when I moved the mouse as expected. No black screen anywhere.



Powered by Free Banners
timer help
12
Years of Service
User Offline
Joined: 14th Jan 2014
Location:
Posted: 21st Feb 2014 19:17
hmm... I don't know why its working for you. I do not have a black picture and I waited 10 minutes and the picture did not load. My picture is a blackboard. I tried putting it in different files and on my desktop but nothing worked. Is there a certain place where I am supposed to put it.
ShellfishGames
13
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 21st Feb 2014 20:08 Edited at: 21st Feb 2014 20:15
If the image doesn't load, DBP would tell you. If you just don't see anything.. well... I really don't know.
Maybe replace this part:



with this:



If you get the "Entering the Loop..." message, you can be sure the error is inside the loop and not anywhere before.
Then check what the print statements say about the image and check the coordinates while moving the mouse.

timer help
12
Years of Service
User Offline
Joined: 14th Jan 2014
Location:
Posted: 24th Feb 2014 19:00
New Problem: It goes past the "entering loop." Then it says "Pasting image 1 to (random numbers). It also says image size 0x0 and I can't do anything at that point.
ShellfishGames
13
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 24th Feb 2014 19:11
Could you maybe upload the exact image here? Maybe there's something wrong with the file. If that's OK with you (and you're allowed to upload it, of course), simply attach it to the next post.

Also, do the "random numbers" at least equal your mouse position? And with "I can't do anything at that point" do you mean everything just freezes, or just that you can't get out of that screen? If it's the latter, that's sort of "intended", since right now we're just trying to track down the problem with your image.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 25th Feb 2014 01:07
Sounds like you have the image in the wrong folder. DBPro doesn't always report an error when it can't load an image. Try this (when none of the image files exist):





Powered by Free Banners
ShellfishGames
13
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 25th Feb 2014 03:28
Quote: "DBPro doesn't always report an error when it can't load an image."


Really? I'm using DBP for about 10 years now and never noticed that kind of behaviour. Fascinating.

Login to post a reply

Server time is: 2026-07-07 01:53:45
Your offset time is: 2026-07-07 01:53:45