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 / Extracting chunks of a Bitmap

Author
Message
Code Ninja
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: AZ, U.S.
Posted: 20th Mar 2004 17:53
For my RPG I've decided to have all the tiles be in a bitmap file, each one being 32x32. my game also includes a 'board' file which is just the current area the character is in. when it switches boards, i want it to be able to extract the specified tile from the bitmap and paste it to the screen (sytax would be "filename$,x,y,soldity" filename$ being the bitmap name + the tile number i want. ex. tile.bmp1). how would i do this? I have DBC with 26 days left on the enhancement. If anybody has any ideas on how i would go about this please post or email me @ [email protected].

Thanx in advance,
~Code Ninja

PC: Pentium II, 333Mhz, 128 Mb SDRAM, 20 & 4Gb hard drives, 8Mb Videocard, DBC 1.13
~Dragael Software
Cybermind
Valued Member
22
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 20th Mar 2004 19:08
Here's some code, will that do it?


I can go in details if you like, you can always delete old image in start of subroutine to save memory. gotta go eat now, the others are waiting.

Cheers, CyberMind
Code Ninja
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: AZ, U.S.
Posted: 20th Mar 2004 19:14
thanx... only problem is im doing a 2D rpg and i am really bad at this 3D stuff. Its a great idea though.

PC: Pentium II, 333Mhz, 128 Mb SDRAM, 20 & 4Gb hard drives, 8Mb Videocard, DBC 1.13
~Dragael Software
Cybermind
Valued Member
22
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 20th Mar 2004 19:45
hmmm, have you made a code that positions the bitmaps where they should be? cause I think that you can still load the bitmaps and extract the image the way I explained, and then put them where they should be, I have never programmed much in 2D, but if you show me some code, then I could figure it out if you like
Code Ninja
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: AZ, U.S.
Posted: 20th Mar 2004 19:49
i havn't gotten that far quite yet (for the code anyway). i was just trying to figure it out so that i wouldn't have to cls the screen whenever i wanted to load a board... but anyway, i g2g do the dishes, so i'll get back to you on that

PC: Pentium II, 333Mhz, 128 Mb SDRAM, 20 & 4Gb hard drives, 8Mb Videocard, DBC 1.13
~Dragael Software
Cybermind
Valued Member
22
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 20th Mar 2004 20:09
allright, seems like you will need an editor to make every board (that will make it easier to make a lot of boards quick) and then make a function that understands this editor output files, I started a little programming in my head, it will not be too hard, but an exiting task
Code Ninja
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: AZ, U.S.
Posted: 20th Mar 2004 20:35
yeah, i was planning on making an editor for my board files (.brd). the syntax for it is:
bmpname$,x,y,solidity (x,y,solidity being numbers writen as bytes and bmpname$ being the name of the bmp + a number representing a tile ex. "tileset.bmp1" would be a grass tile or something like that.) so yeah, the only problem is, when im creating a board in the editor, i can only create it a certain size because i don't know how i would scroll through the board. then theres also the solidity thing and whatnot... but as you said, it is doable... what did you have in mind?

PC: Pentium II, 333Mhz, 128 Mb SDRAM, 20 & 4Gb hard drives, 8Mb Videocard, DBC 1.13
~Dragael Software

Login to post a reply

Server time is: 2025-06-02 04:18:54
Your offset time is: 2025-06-02 04:18:54