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 / Images will not appear before game loads

Author
Message
Ashley Leppington
12
Years of Service
User Offline
Joined: 1st Mar 2014
Location:
Posted: 10th Mar 2014 17:18
Hello everybody.

I am trying to load a title screen and then another image after the title screen has been deleted.



I think there needs to be something between the paste image and fade image. This is because it looks like to me the image is just getting deleted straight away.

Many Thanks

Ashley Leppington
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Mar 2014 15:30
Where did you get the fade image command from? I can only see fade object here.



Powered by Free Banners
ShellfishGames
13
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 11th Mar 2014 16:42
Is there a reason you're using variables when loading the images ("kgh_prods_image" and "presents_image"), but constant numbers with all the other commands? Are you sure kgh_prods_image has the value 101? If so, just stick to the variable instead of using a variable here and a constant value there.

How does to fade_image function look like? It's kind of important for finding out why your code doesn't work.

And finally, often in these cases it's just a missing sync command behind the paste image.

Ashley Leppington
12
Years of Service
User Offline
Joined: 1st Mar 2014
Location:
Posted: 11th Mar 2014 18:07
Quote: "
Is there a reason you're using variables when loading the images ("kgh_prods_image" and "presents_image"), but constant numbers with all the other commands? Are you sure kgh_prods_image has the value 101? If so, just stick to the variable instead of using a variable here and a constant value there.

How does to fade_image function look like? It's kind of important for finding out why your code doesn't work.

And finally, often in these cases it's just a missing sync command behind the paste image."


Hi shellfish games. The constant values are correct. I have deleted the variables after the image file and used constants instead. Also the images still do not load but at least my game does run as it did not before. Do the images not load because I have put the constant twice next to the fade image. I am a beginner to programming and I only started learning since September.

My new code is below

`wait 1000
load image "media\backdrops\Starting_Screen copy.png", 101
paste image 101, 0,0,0
Fade_Image(101, 101)
delete image 101

`wait 1000
load image "media\backdrops\Instruction_Screen.png", 102
paste image 102, 0,0,0
Fade_Image(102, 102)
delete image 102
[quote]

Many Thanks and feedback is greatly appreciated.
Rick the Programmer
22
Years of Service
User Offline
Joined: 23rd Mar 2004
Location: Maryland
Posted: 11th Mar 2014 22:44
There's not much info here to work with, but your image should be appearing...

Sometimes it's the image itself that will fail to load. If the image fails, then nothing will appear even though the code executes.

2 things that can be done to root out your problem are:

-Try a small, simple MS paint .bmp file with this code. If it executes properly then the problem lies with the image itself.

-Try texturing the image onto a sprite or plane object instead of the paste image command.

sprite 1, 0, 0, 101


It might be helpful to know what the Fade_Image(int, int) function does if these steps don't shed any light on your dilemma.

Ask not for whom the bell tolls;
It tolls for ye!
Rick the Programmer
22
Years of Service
User Offline
Joined: 23rd Mar 2004
Location: Maryland
Posted: 11th Mar 2014 22:46 Edited at: 11th Mar 2014 22:55
Another thought is that with image pasting, you may have to call it once per loop to keep it up. With the Paste Sprite commands it is the case that you must keep pasting the sprite to keep it visible on the screen. Once your pasting stops, the sprite is wiped from the screen. By pasting the image once then moving forward, it may only be visible for 1 frame, giving the impression that it never loaded in the first place



Edit: I tested it and if you start doing 3D antics, the pasted image disappears. Loop pasting keeps it on screen. Using a sprite is probably your best option, though.




I wouldn't delete the image until you're done with it.

Ask not for whom the bell tolls;
It tolls for ye!
ShellfishGames
13
Years of Service
User Offline
Joined: 6th Feb 2013
Location:
Posted: 11th Mar 2014 22:56 Edited at: 11th Mar 2014 22:58
She seems to try to paste these images before the main loop ("before the game loads").

So, as mentiond earlier, this could still just be a missing sync call. And Ashley, please post the Fade_Image() function declaration as well. We can't really tell what your code is doing as long as we don't know what that function does.

However, you could start off by trying this:



If this still doesn't show the image, there's probably something wrong with the image file.



I personally don't think using sprites is necessary here, as paste image is perfectly capable of achieving the desired effect and sprites might just cause unnecessary confusion.

Login to post a reply

Server time is: 2026-07-06 18:12:06
Your offset time is: 2026-07-06 18:12:06