help needed! blitting question!
Displaying 1-12 of 12 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
ExSea

i ve been foolin around wiv verge since v1.
somehow stopped for unknown reasons, now back verging again coz i m allowed to use verge as the game engine for my project :p

anyway this is wat i need help on :

how do i blit images underneath the entity layer?

i notice most battle systems use images and have the entities drawn on top (i m not sure at this but thats what i understood from the coding -correct me if i m wrong >_<)

another thing is:

the blitting command is: blit(x,y,imagename,destimage);
i usually notice destimage is 'screen'
are there any other variables that can replace this?

can any1 help me?

Posted on 2004-10-27 13:48:15

Sungam

how do i blit images underneath the entity layer?
As far as I know, this can't be done (except with sprites, maybe? I really haven't touched those much).
However, you can hack it.
After blitting whatever it is you want below the entities, run a loop that goes through all entities on the map (or on the screen, if you want to optimize a bit) and blit entity.frame[entity_id_here] on top of that.
So:

Blit(x,y,whatever,screen);
for(i=0; i<entities; i++)
BlitEntityFrame(entity.x[i]-xwin, entity.y[i]-ywin, i, entity.frame[i], screen);
ShowPage();

... or something to that effect.

the blitting command is: blit(x,y,imagename,destimage);
i usually notice destimage is 'screen'
are there any other variables that can replace this?

It's simply an image. The destination image could be one you loaded with LoadImage, created with NewImage, or the 'screen'. 'screen' really is just an image that represents what will be sent to the monitor on the next refresh.
The reason you would want to blit to the screen usually, is that most commonly you just want whatever you're doing to show up right away.
But say you were creating an image dynamically, which you were to use several times, it would be much more efficient to create a new image (using NewImage), draw onto that, and then blit that new image onto screen whenever you wanted to use it.

Let me know if my rambling confused more than it helped, and I'll think of a better way to explain.


EDIT: Whoops, minor artifact from my reused code went in there, making very little sense.

Posted on 2004-10-27 14:10:47 (last edited on 2004-10-27 14:12:06)

Interference22

Actually, it IS possible but a little hard in places:

Each map has what's called a 'renderstring.' Basically, this is a string that lists the order which VERGE is supposed to render the layers of a map onto the screen. What it ALSO does is allow you to specify when images you blit to the screen are rendered. Usually, it's after all the layers but you CAN change it so that it's in the middle of the layers, or below the player.

The renderstring looks a bit like this '12345R'. The 'R' bit denotes where all the Blit stuff gets rendered. You can alter it via the code and in Maped3.

For an example of this sort of funkiness in use, grab the latest version of Sully (see the sidebar) and check out the code for Lord Stan's lab, the bit with Crystal in a block of ice: there's a nice effect in-game with scrolling clouds and stuff.

Posted on 2004-10-27 14:22:04

Feyr

Also (this may be what Interference22 was talking about, as I haven't looked at Sully yet...though I doubt it, from the way he described it) it is possible to blit at multiple points in the renderstring, as I understand. A renderstring like '12RE3R' will render once beneath the entities and once above everything. You'll have to take this into account when writing your rendering function, like so:


int RenderState=0;
void RenderStuff() {
if(RenderState == 0) {
// Blit the things that need to appear beneath
// entities
RenderState++;
} else if(RenderState == 1) {
// Blit the things that need to appear above
// everything.
RenderState = 0;
}
}


If you plan to do a lot of this sort of thing then you might consider writing or using a rendering lib to handle different types of rendering that need to be done at different times. I believe I have a lib in the V3 utilities section that could be modified to handle multiple render layers with a little bit of work, but I forget the name and I'm in a hurry...gotta go.

Posted on 2004-10-27 19:29:07 (last edited on 2004-10-27 19:51:01)

Wolf

Quote:Originally posted by Interference22

The renderstring looks a bit like this '12345R'. The 'R' bit denotes where all the Blit stuff gets rendered. You can alter it via the code and in Maped3.


The renderstring dispays the order in which stuff is drawn right? The numbers are the layers and the E is the entity-layer.
So if you want your stuff to be drawn above the map, but behind the entities you'd have something like '12RE'
Render first, then draw the entities.

Posted on 2004-10-27 23:14:59

ExSea

10x peeps!! tat really helped! i dun remember how much time i spent trying 2 figure this thing out >_< finally the mysteries of the universe have been revealed :p

Posted on 2004-10-28 01:52:15

ExSea

ermm.... allooooo
me again :p
how do u cr8 a new R layer in maped?
seems like i can only create the normal map layers...

hmmm
been thinking.... wouldn't having 2 R layers such as
1,2,R,E,R

blit an image both on top and below the entity layer whenever blits are called regardless of coding?

Posted on 2004-10-28 02:02:22 (last edited on 2004-10-28 02:08:52)

zonker6666

You can do that in vc ...
curmap.rstring='1,2,R,E,R';

Posted on 2004-10-28 02:24:04

Overkill

Quote:Originally posted by Znigma

ermm.... allooooo
me again :p
how do u cr8 a new R layer in maped?
seems like i can only create the normal map layers...


The 'R'/hookretace layer is already created with every map. There should be a certain layer in the layer dialog that says something like 'Special: Retrace' or something.

Also, if you wanted a more than one retrace, it's a little hacky, but doable... It's a bit technical, but an ugly-looking tech demo by the name of 'Lax' shows how to create such a thing to some extent. Zip seems to know a good deal about this type of thing.

Though, you could always use Aen's PSD2MAP (Check his LiveJournal), and then it will convert a Photoshop image into MAP file easily.

Posted on 2004-10-28 02:55:31

ExSea

k k
i think i figured it out

i have 2 do something like this

somefunction
for 1st layer
change to 12re
blit blablabla
end
for 2nd layer
change to 12er
blit blablabla
showpage
end

Posted on 2004-10-28 03:23:27

Omni

Sounds like you've got it.

Posted on 2004-10-28 04:56:10

Wolf

The layers in the 'LAYERS'-tab in the bottom right of maped3 are drawn in the order of the renderstring. From top to bottom.
You can move it up or down with those arrows in the same tab.

That's the way I always do it anyway...

Posted on 2004-10-28 11:02:58


Displaying 1-12 of 12 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.