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 Bitmap and Re-Load

Author
Message
Scouseknight
20
Years of Service
User Offline
Joined: 15th Mar 2004
Location: Bootle, Merseyside, UK
Posted: 17th Apr 2004 01:52
I'm having a bit of a battle with Delete Bitmap and Load Bitmap.

When I delete a bitmap, and then re-load it later, I receive Runtime Error 1003 - unable to load bitmap at line xxxxxx.

The code runs first time through so the bitmap's path is not the problem - despite doing a delete bitmap x after finishing with it, I am unable to perform a subsequent load without this error appearing.

I even took the (I feel) unnecessary step of doing this :



and I STILL get the error message - without fail - same line each time.

I've been working on this all evening so I guess I might need a break to come back and spot something really obvious but thus far it has me baffled.

The path of the file is 100% not the issue

Blue Shadow
20
Years of Service
User Offline
Joined: 6th Feb 2004
Location:
Posted: 17th Apr 2004 01:56
If you were using the image as a sprite maybe instead of deleting it you could use the hide sprite command. Then when you want to load it again you could reposition it in the correct place and then use the show sprite command. I hope that helps.

Cheers,

Michael


Visit the Code Monkey's website at http://www.freewebs.com/codemonkeystudios
medwayman
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: uk
Posted: 17th Apr 2004 03:10
Are you using the same code to reload the bitmap? Just wondering if you put the correct file type the second time. I’ve tried to load a .png with a .bmp extention in my code. Took me ages to find it.

Based on Amiga PD game Squigs. Early shots: http://www.custardsoft.pwp.blueyonder.co.uk/images/03.png

Scouseknight
20
Years of Service
User Offline
Joined: 15th Mar 2004
Location: Bootle, Merseyside, UK
Posted: 17th Apr 2004 14:28
Cheers for the help fellas.

It is the same piece of code running both times - the image is just a blue screen from which I cut out the collision boxes for the game's floors, walls and ladders.

I haven't re-looked at this yet - but it'll probably jump out now I have fresher eyes on it!!

I'll bare all the advice in mind when I do too - it'll probably smack me in the face!

Scouseknight
20
Years of Service
User Offline
Joined: 15th Mar 2004
Location: Bootle, Merseyside, UK
Posted: 17th Apr 2004 14:41
Hmm I isolated the code and ran it seperately in it's own program - a couple of things :

1) It worked pefectly
2) You don't even need to delete the bitmap or image to re-load others into the same numbers

So armed with this, I did some commenting out e.t.c. in the main game and discovered that the error just moves to another Load Image command when I comment the line out - so it's something else deep in the bowels of my program triggering an incorrect error and line number.

I say this only because it has happened to me before - I had a piece of code to load an image, then something else after it which was wrong and the error message was always pointing to my load image line when in fact it was another piece of code afterward causing it - this was in an early program I wrote weeks ago not this one.

Scouseknight
20
Years of Service
User Offline
Joined: 15th Mar 2004
Location: Bootle, Merseyside, UK
Posted: 17th Apr 2004 20:06 Edited at: 17th Apr 2004 20:30
Still no closer to spotting this - I have included the level load function source here :



I can manually set the Player1Level variable to 2 and it will successfully load the second level when the game starts.

If I let the game do it itself (as in add 1 to the Player1Level variable and call this function), I recieve the runtime error I referred to in my earlier post.

The difference here is I am not loading the bitmap anymore I am just trying to load two images that I know exist and in fact do load the first time through if I manually set the variable player1level.

It's beginning to drive me around the twist!!

Scouseknight
20
Years of Service
User Offline
Joined: 15th Mar 2004
Location: Bootle, Merseyside, UK
Posted: 17th Apr 2004 20:56
I've coded around this problem now so my game is back on track.

I am loading all the level images now and referencing them instead of loading on the fly between levels - I can't afford more time messing about with this to be quite honest - I can always go back and revisit it when the rest of the game has completed.

Login to post a reply

Server time is: 2024-09-22 05:45:40
Your offset time is: 2024-09-22 05:45:40