Message Board
Message Board > Fenix / Bennu / Gemix / DIV > Tileset loading & cutting code not working, please help |
April 28, 2007, 17:17 | |
Quiest
now with more happynes 142 posts |
This is it; simply does not show the tiles Code: process load_set(set_nr)
private temp; int i; begin temp=load_png("data/tileset"+set_nr+".png"); for(i=0; i<4; i++) if(!map_exists(0,tileset[i]))tileset[i]=new_map(dim-2,dim-2,bmode);end; map_block_copy(0,tileset[i],0,0,temp,i*(dim-2),0,dim-2,dim-2,0); end; unload_map(0,temp); end; ____________ Roundhousekick to the face, baby! |
# |
April 28, 2007, 17:40 | |
Woody
HEAD BLACK MAN 722 posts |
Is temp loading the right graphic? What's with the semicolons after the ENDs? And why isn't there one after the process parameters? [Edited on April 28, 2007 by Woody] ____________ boredome is the bitter fruit of too much routine |
# |
April 28, 2007, 18:40 | |
Quiest
now with more happynes 142 posts |
you can do it this way in Fenix ^^ and the temp was correctly loaded, It just seems that map_exists does not work. I`ve created the maps globally now and it works. My game just needs a fancy tileset now und some music & soundeffects ____________ Roundhousekick to the face, baby! |
# |
April 28, 2007, 19:18 | |
Eckolin
Quite Whiskered 388 posts |
Map 0,0 is the background, if I remember correctly.
____________ Maker of Games... Wisdom is supreme; therefore get wisdom. Need help with coding? I probably wrote something similar. |
# |
April 29, 2007, 02:04 | |
danko
Whiskered 31 posts |
map_exists will always return 1 when (0,0) is used since there is allways a background once the video has been initialized (after calling set_mode). Assuming that comparing tileset[i] to 0 may not be enough for you, one possible solution to your code would be to initialize all elements of tileset[] array to -1 for example. map_exist(0, -1) will return 0, as expected. ____________ |
# |
April 29, 2007, 14:19 | |
Quiest
now with more happynes 142 posts |
right ^^ got it thanks
____________ Roundhousekick to the face, baby! |
# |
April 29, 2007, 14:39 | |
Sandman
F3n!x0r 1194 posts |
Quoting danko: Assuming that comparing tileset[i] to 0 may not be enough for you, one possible solution to your code would be to initialize all elements of tileset[] array to -1 for example. map_exist(0, -1) will return 0, as expected. map_exists(0,-1) will return 1, because bitmap_get(0,-1) returns the screen bitmap, so it's a map. bitmap_get(0,-2) seems to return something as well, but that might be undefined behavior. I suggest a check if the map is >0 and then map_exists(). 0.84b source: Code: /* Using (0, -1) we can get the screen bitmap (undocumented bug/feature) */
if (mapcode == -1) { if (!scr_initialized) gr_init(320,200) ; if (!scrbitmap) gr_lock_screen() ; return scrbitmap ; } ____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
April 29, 2007, 17:51 | |
Fiona
games are terrible -9616558 posts |
Quoting Woody: And why isn't there one after the process parameters? Are you joking? ____________ laffo |
# |
April 29, 2007, 18:56 | |
Woody
HEAD BLACK MAN 722 posts |
Quoting Fiona: Quoting Woody: And why isn't there one after the process parameters? Are you joking? No. ____________ boredome is the bitter fruit of too much routine |
# |
May 1, 2007, 21:06 | |
Fiona
games are terrible -9616558 posts |
Quoting Woody: Quoting Fiona: Quoting Woody: And why isn't there one after the process parameters? Are you joking? That has never been required, not in DIV and not in Fenix, it just looks weird, it's not the end of a statement it's the opening of a process. ____________ laffo |
# |
May 2, 2007, 21:15 | |
Quiest
now with more happynes 142 posts |
Lovely Fiona is right, I tended to make these ; at the ends of process heads too, but I have quit doing them since I got deeper into C/C++ programming. It really makes more sense to not put them there. I still hang them to the ends tho ____________ Roundhousekick to the face, baby! |
# |
May 22, 2007, 14:25 | |
Dennis
どこかにいる 2092 posts |
In PL/SQL it is also done. Placing ; after Ends and shit. It generates errors if you don't though. ie. Code: Declare variable varchar2 := null; Begin If (something is not null) For myrecord in (select t1.name, count(t2.pk) "FISHIES" from my_table1 t1, my_table2 t2 where t1.t2pk = t2.pk group by t1.name having count(t2.pk) > 5 ) htp.print('</br><p>'myrecord.name || ' has ' || myrecord.FISHIES ' in the aquarium (minimum 5)!</p>'); End Loop; End If; End; yeah sorry I was bored :/ but as you can see, it looks a bit like fenix/div :p only for different purposes [Edited on May 22, 2007 by Dennis] ____________ Kwakkel |
# |
Message Board > Fenix / Bennu / Gemix / DIV > Tileset loading & cutting code not working, please help