Blit() not working or something
Displaying 1-3 of 3 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
it_is_coming

so I'm pretty noobish with verge, so there might be something going on here that I don't know about, but here's my problem. I want the maps in my game to just be hand drawn images that I would then put obstructions and stuff over, so I made a function that is supposed to put the background image on the screen. but the images don't show up. Here's the function:

void DrawMap(string bgfile)//file path to the imagefile
{
int bg;
bg = LoadImage(bgfile);
Blit(1, 1, bg, screen);
}

then in the map code I call the function with the background's file path. I don't get any compilation errors, but the image doesn't show up. i'm guessing it's probably something that I'm doing completely wrong and you have the right to humiliate me if it is.

Posted on 2008-07-23 21:42:26

Overkill

Well actually Blit() *is* working, you just can't see it!

This is where ShowPage() comes in handy.

But wait. I see problems afoot.



:(

You're loading the image on EVERY call to DrawMap, which means it'll take a LOT of time loading in the background every call. It also never frees the old bg with FreeImage(bg);, so it'll leak memory, which means it'll crash pretty quick.

Also, (0, 0) is the top-left most pixel, so everything's off by one.

Really, I'd recommend another way to do this all. Open up MapEd, create a new map. Then go to VSP >> Import. Make destination tile bank "Tiles", insertion method "Append" and data source "Image file". Make sure Source Padding is unchecked, and Create Layer From Image is checked.

What'll this do? It'll import a tileset and immediately draw those tiles onto a layer. As long your image size as a whole is some multiple of 16, you can treat the whole thing as a bunch of tiles.



Although, there's another way, too. You can put the "retrace" layer at the bottom of the map, and then use HookRetrace to call a function that blits bg. Just uhm, don't LoadImage() in this routine, load the bg beforehand, like on the start of map or something.

I'm thinking the import method's easier. The retrace method could be handy for SOME purposes, but I wouldn't recommend it if you're gonna have lots of maps and want to figure out where to plot obstructions and stuff.

Posted on 2008-07-24 03:12:50

it_is_coming

oh yeah, didn't think about having to place obstructions, thanks. I'll try it.

Posted on 2008-07-24 15:15:35


Displaying 1-3 of 3 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.