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.

Bug Reports / Load Image/Sprite functions don't work correct

Author
Message
RFrijhoff
3
Years of Service
User Offline
Joined: 28th Mar 2014
Location:
Posted: 12th Apr 2014 14:25
Unfortunately I have another problem. This time the load image/sprite functions don't seem to work correct.

When I load a first sprite, there is no problem.
+ Code Snippet

However when trying to load additional sprites, it becomes all messed up.

Load and display a 2nd sprite:
non-working code (as you would expect it to work)
Result is: 2nd sprite is not loaded and instead of 2nd sprite displayed, 1st sprite is displayed.

+ Code Snippet

This means that it looks like it ignores the image number parameter specified at the load image command and can only store one image.

Attachments

Login to view attachments
Green Gandalf
12
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 12th Apr 2014 17:30 Edited at: 12th Apr 2014 23:13
This is the same problem you had before. What Window resolution are you using?

Your code works fine for me.

Edit Actually, your problem might have a different explanation. What happens when you comment out the first "wait key"?



Powered by Free Banners
RFrijhoff
3
Years of Service
User Offline
Joined: 28th Mar 2014
Location:
Posted: 13th Apr 2014 23:02
First of all, it's absolutely not the same problem. In the first problem, I just got wrong sized images/sprites which was fixed by changing the window resolution.

In this case I don't get the sprites I should get.

See attached screenprint of the result of the code:
+ Code Snippet
As you can see, the 2nd sprite is exactly the same (only scaled 50%) as the first sprite where as this should be a different sprite.
The wait key makes no difference at all (and it shouldn't).

Attachments

Login to view attachments
Green Gandalf
12
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 14th Apr 2014 17:13
Sorry. I misunderstood what the problem was. I didn't notice that you'd used the same image id in your two sprite commands - that's why you get only one image. Just correct that and you'll be fine.

It's still not a DBPro bug.

You should try to get your code checked in the main forum before posting here. In this case you should probably have spotted the error yourself - but then who am I to talk.



Powered by Free Banners
RFrijhoff
3
Years of Service
User Offline
Joined: 28th Mar 2014
Location:
Posted: 15th Apr 2014 09:18 Edited at: 15th Apr 2014 09:23
Quote: "I didn't notice that you'd used the same image id in your two sprite commands"

It seems that you checked only the screenshot and not the code, otherwise you would've seen that I didn't use the same image ID for both sprites.

+ Code Snippet

and the same goes for the sprite commands. (Check code!)

Even more to proof something is off:
I commented out the sprite commands and inserted make object plane and texture object commands:
+ Code Snippet

And now I do get 2 different images as it supposed to be.
Green Gandalf
12
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 15th Apr 2014 12:06
Quote: "It seems that you checked only the screenshot and not the code"


Er, what do you mean? Those two commands are load image commands not sprite commands.

Quote: "and the same goes for the sprite commands. (Check code!)"


I have checked them. Have you?

Here are the offending lines in your code:

+ Code Snippet

A simple check of the Help file will tell you how to use the sprite command.


Quote: "And now I do get 2 different images as it supposed to be."


Because you did it right that time.



Powered by Free Banners
RFrijhoff
3
Years of Service
User Offline
Joined: 28th Mar 2014
Location:
Posted: 15th Apr 2014 14:53
I know now where the confusion lies. In every other program I know, when the image number is used in conjunction with sprite, it means the number of the image within the sprite (animated sprites) and not as in Dark Basic the loaded image.

This should be really much better explained in the help file (and a good tutorial would help too).

Thanks anyway for your help and my apologies for the inconvenience.
Green Gandalf
12
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 15th Apr 2014 16:25
No problem - we are all aware of the obscurities in the Help files.



Powered by Free Banners

Login to post a reply

Server time is: 2017-06-26 02:57:41
Your offset time is: 2017-06-26 02:57:41