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.

Newcomers DBPro Corner / Loading Pictures and Sprites

Author
Message
Lucas Tiridath
AGK Developer
16
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 17th Oct 2008 21:36 Edited at: 17th Oct 2008 22:44
Right, well I'm making a game and I simply want to place three buttons on the screen. Each button simply has two frames; pushed down, and not pushed down. All three were made based on just one template and they were made in Paint. Yet, when I load and display them in the code bellow, two come out at double the size while one remains correct. Has anyone any idea why this is happening? Here is the code I think could possibly be relivent to this problem:



This is the majority of the code so far. I have only left out a few irrelivent variables which are not yet used at all. It is sprites 4 and 5 which are becoming double sized; 3 is working fine. I can assure you that they are all 808 X 51 pixels with both frames together.

Any help would be greatfully recieved. Just ask if there is any relivent information I have left out. Thanks in advance for your help.
Deego
16
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 18th Oct 2008 08:09 Edited at: 18th Oct 2008 08:11
You shouldn't be so specific when loading images. Other computers running the program won't be able to find the images to load, since not everyone is named Laurie. Load media using the .exe as a base. If your .exe is in "C: Documents Game thegame.exe", then keep your media in subfolders in the Game folder. So instead of "C: Documents Games Pics Cycling RaceOpponent.bmp", use "Pics Cycling RaceOpponent.bmp". When distributing the game, keep the folders in the same place in relation to the .exe.

Also, there's no point in creating animated sprites with one frame. Just use load image in that case.

I can't tell why your images aren't sizing correctly from the snippet you posted. Try adding ,1 after loading image 6. This flag will set the image into a high quality mode or something like that, and that can have effects on how other images are displayed. Maybe, I'm not sure exactly how it works, but I don't load an image without it.
Lucas Tiridath
AGK Developer
16
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 18th Oct 2008 20:42
Thanks for the tips people. I have moved the pics into a subfolder of the exe. However my main problem still remains... Why do they double in size. After correcting a couple of errors, I can see the problem more clearly now. The strange thing is that they are double the width they should be but not double the height.

Any help on this or anything else is much apreciated.
Deego
16
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 19th Oct 2008 01:54
I never thought of that, thanks WindowsKiller! But doesn't that mean you can't set that image's texture flag (looked up what it was )? You couldn't use sprites with alpha channel transparencies, or could you?

Lucas, try deleting and rewriting the portions of the code pertaining to these buttons... make a backup dba first, though. It's not a guaranteed fix, but by rewriting the code you may find a small error causing the problem. I remember having a horizontal stretching problem once when using animated sprites, but I can't recall how I fixed it :\
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 19th Oct 2008 04:00
This works.
How can you see it?

Attachments

Login to view attachments
Lucas Tiridath
AGK Developer
16
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 19th Oct 2008 14:28
Thanks once again for your help.

pcRaider; thanks for the code but you know, it still doubles the width of the first two versions of a. The third one works fine, just like when it has my credits sprite in it. Does this not happen for you?

If not, I may try uploading my version of the game with sprites to see if anyone else has the same prob as me. Thanks once again.
pcRaider
17
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 19th Oct 2008 15:24 Edited at: 19th Oct 2008 15:26
Your DBP is mysterious.
I need your information.
-
1) Is it Windows Xp or Vista?
2) What is a version of DBP?
Are you latest Version?
http://darkbasicpro.thegamecreators.com/?f=upgrades
-
You can attach a .exe file.
Lucas Tiridath
AGK Developer
16
Years of Service
User Offline
Joined: 28th Sep 2008
Location: Kings Langley, UK
Posted: 20th Oct 2008 11:51
I think I've just found the problem, or more acuratly, a solution to it. When I set the frame before offsetting the sprite, it work. I have no idea why that should be though.

I am working on XP and I got my DBP fairly recently so I can't imagin I'm very far behind in unpgrades. Thanks for all your help.

Login to post a reply

Server time is: 2024-11-24 19:38:41
Your offset time is: 2024-11-24 19:38:41