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 / Delete Image problem

Author
Message
Twinsen
18
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 13th Mar 2008 20:08 Edited at: 13th Mar 2008 20:51
well here's what happens:

- I have 2 IDENTICAL pieces of code as follows

CODE 1
................
CODE 2

- inside CODE 1 ( or CODE 2 cause they are the same ), I load an image like this: LOAD IMAGE Filename, Image Number 1 ... so I have Image 1 loaded ....
- between the 2 codes ( CODE 1 and CODE 2 ) I delete the image and the sprite which is attached to it
- now when I run the program, even though both codes are the same, the second one won't work ... WHY ???? I know I've deleted the image and sprite but since the 2 codes are identical, the image and sprite should load again as it did the first time ... what's the problem ??? please help me as it's driving me crazy (((

Could you help me treat my injured Dino-Fly ?
Twinsen
18
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 13th Mar 2008 20:11 Edited at: 13th Mar 2008 20:52
to explain better, here's what I do:

load image "xxxxxxxxxxxxx" ,1
=== do some stuff here ===

delete sprite 1
delete image 1

load image "xxxxxxxxxxxxx" ,1
=== do the same stuff here ===

so as you can see, the DELETE SPRITE 1 and DELETE IMAGE 1 commands are placed between 2 identical code blocks, so even though the image is gone for a moment, the second block should work because first of all, it loads it back up, right ???

Could you help me treat my injured Dino-Fly ?
Twinsen
18
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 13th Mar 2008 21:47
so it's a sort of a bug then ??? also, I know how to make it work but it's just that I don't get what could go wrong ... anyway, if I load another image in number 1 while there's another image inside, will it overwrite it or give some other unexpected error ??? thanks WindowsKiller

Could you help me treat my injured Dino-Fly ?
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th Mar 2008 23:22
Yes, you can reload an image into an existing DB image slot without deleting it first. The first image will be overwritten.

As Windowskiller says, it's probably down to your computer trying to execute lines before a previous action has been completed. You can test this by putting a Wait line in:

delete sprite 1
delete image 1
Wait 1000


I know this probably isn't any use as a solution, but if it then works, at least you know what the problem is.

If that does solve the problem, then you might get away with using something like Wait 10 which could work, but have no visible delay.

Or you can go with the suggestions WindowsKiller gave - which are better.

TDK_Man

Twinsen
18
Years of Service
User Offline
Joined: 20th Jun 2006
Location: Romania
Posted: 13th Mar 2008 23:34
again, thanks a million I'll try and see what I can dig up

Could you help me treat my injured Dino-Fly ?

Login to post a reply

Server time is: 2024-09-27 12:18:27
Your offset time is: 2024-09-27 12:18:27