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 / whats wrong with my sprite code (slicing images up)

Author
Message
Pyromaniac
21
Years of Service
User Offline
Joined: 8th Jan 2003
Location: United Kingdom
Posted: 12th Feb 2003 18:38
Can somebody please tell me what is wrong with this code



i want to make the first 15x15 pixel area of this image into a sprite, but i get nothing when i run it
You could take over the world with a programming language like this...

...I wasnt joking!
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 12th Feb 2003 19:20
Uhm, not sure, but if your image is actually 15x15 pixels, then use get image 1,0,0,14,14 seeing as 0 is counted. Also, DBP has a buggy sprite system, so that might also be the problem. In that case, you'll have to wait for the patches.

Whatever I did I didn't do it!
xmen
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location:
Posted: 12th Feb 2003 20:03
if you are grabing a image use

load bitmap "tiles.bmp",1
get image 1,0,0,15,15
sprite 100,25,25,1
show all sprites


but if loading a image use

load image "tiles.bmp",1
sprite 100,25,25,1
show all sprites


hope this help
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 12th Feb 2003 21:13
"Also, DBP has a buggy sprite system, so that might also be the problem"

Err.. no it doesn't! His program fails because he's trying to grab from a blank bitmap. The get image command isn't needed (nor is the show all sprites btw).

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Pyromaniac
21
Years of Service
User Offline
Joined: 8th Jan 2003
Location: United Kingdom
Posted: 12th Feb 2003 21:14
Ok, i got it to work using this code



apparently i need to delete the bitmap for some reson, if i dont i just get a black screen

everything works fine now, but would someone mind explaining this to me?

You could take over the world with a programming language like this...
...not that I would attempt to...yes, that'll do...
Pyromaniac
21
Years of Service
User Offline
Joined: 8th Jan 2003
Location: United Kingdom
Posted: 12th Feb 2003 21:16
in reply to rich, my bitmap isnt blank, and it contains more than one 15x15 tile, thats why i need the get image command

You could take over the world with a programming language like this...
...not that I would attempt to...yes, that'll do...
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 12th Feb 2003 21:23
If you don't delete the bitmap the screen stays looking at bitmap 1, not bitmap 0. Bitmap 0 is the "physical" screen (i.e. what you can actually see!).

When you do "delete bitmap 1" it is also doing "set current bitmap 0" which is in effect reverting display back to the screen again.

If you don't want to delete the bitmap, just do "set current bitmap 0" after your "get image" command and it will work.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Kentaree
22
Years of Service
User Offline
Joined: 5th Oct 2002
Location: Clonmel, Ireland
Posted: 12th Feb 2003 23:31
Sorry Rich, the demo version of DBPro I had was very buggy in the sprite department. I havent kept up to date on the updates () but this could have been the problem regarding which patch Pyromanic uses.

Whatever I did I didn't do it!

Login to post a reply

Server time is: 2024-11-24 02:23:31
Your offset time is: 2024-11-24 02:23:31