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.

DarkBASIC Discussion / Grab images.

Author
Message
Gumshoe
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location:
Posted: 14th Jan 2004 21:43
I'm having trouble understanding this part of code. I get what it's doing. What I don't understand is the number part. I would like to understand this so I can grab my own image sizes.

rem Load character into hidden bitmap
LOAD BITMAP "runner.bmp",1

rem Grab images for character animation
FOR y=0 to 1
FOR x=0 TO 6
GET IMAGE 1+x+(y*7),(x*89),(y*120),(x*89)+89,(y*120)+120
NEXT x
NEXT y

The part GET IMAGE 1+x+(y*7),(x*89),(y*120),(x*89)+89,(y*120)+120
is what I'm having trouble with. Can any be kind enough to explain this more than what the user guide has to say on the get image?

Thanks
VishalC
21
Years of Service
User Offline
Joined: 14th Jan 2004
Location:
Posted: 14th Jan 2004 22:22
Hi
Im new here so i hope i can help.
Firstly, all those numbers i.e. 1+x+(y*7),(x*89),(y*120),(x*89)+89,(y*120)+120 is merely to get the positioning right. the loop is to make things easier. it gets blocks of the bmp and stores it as an image. 89 is the width of the image, and 120 is the height.
Dont know if that helps, but i tried.

If it wasn't for the last minute, nothing would get done!
VishalC
21
Years of Service
User Offline
Joined: 14th Jan 2004
Location:
Posted: 14th Jan 2004 22:29
p.s. this only works because of the way his bmp looks. Sort of like this:
--------------------
|p p p p p p p p p |
| |
|p p p p p p p p p |
| |
|p p p p p p p p p |
|------------------|

Assume that each "p" is a picture of a person in a different position. the loop stores each "p" using the get image command. he can then cycle through them to create an animation affect.

If it wasn't for the last minute, nothing would get done!
Gumshoe
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location:
Posted: 15th Jan 2004 00:59
Well not really, I understand that the for loop is used to grab the image so it can animate the image in a flip book fashion after you add image=image+1

and I figure the get image part had to do with grabing the correct position. I'm just have a little trouble seeing it. For one thing why did they use 0 to 1 for y in the for loop and why 0 to 6 in the x for the for loop. If it is all possible a break down of the formula could a real help to me. Reason is, what If I have an image that contains not only a character walking right, but also left, up, down, jumping etc. I would need to know how to set up the formula to grab those images. See where I'm stuck at now? Anyhow, thanks for trying to help me out and if you think you can help me out further I'll take all the help I can get. Again, thank you.

Login to post a reply

Server time is: 2025-05-22 06:21:03
Your offset time is: 2025-05-22 06:21:03