entities again
Displaying 1-8 of 8 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
RageCage

Is is legal for me to refer to an ent with the number givin to it? like... if I have

testChr=entitySpawn(0,0,"test.chr");
//lets say testchr now = 2
//then I refer to it with
blitEntityFrame(0, 0, 2, entity.frame[2], screen);

should that work?
the reason I ask is because I'm ending up having to create my own renderEntities function that draws all the visible entities to the screen so I thought I could have a loop something like:

for(i=0;i<entites;i++) blitEntityFrame(stuff);

but verge crashes with no error...

Posted on 2004-05-24 04:26:13 (last edited on 2004-05-24 04:29:04)

el_desconocido

I tried it and at first got the following error:

Exiting: CHR::render(), frame requested is undefined (87178496 of 30)

I'd guess it's drawing the map once before the ent exists. So I used:
if(fps_counter > 0) BlitEntityFrame(100, 100, 0, entity.frame[0], screen);
and it worked fine. (perfectly mimics my char's frame) fps_counter is my own, not built in, so add some type of variable to avoid drawing the ents on first render, maybe that's the problem.

El

Posted on 2004-05-24 06:54:18

Gayo

BlitEntityFrame does take the entity number, I think.

Posted on 2004-05-24 11:02:11

el_desconocido

You sir are correct. The first entity's number is 0. In fact that could cause a crash as well, if one were to assume that the second entity spawned is entity.blah[2].

El

Posted on 2004-05-24 14:32:43

Overkill

Quote:Originally posted by RageCage

Is is legal for me to refer to an ent with the number givin to it? like... if I have

testChr=entitySpawn(0,0,"test.chr");
//lets say testchr now = 2
//then I refer to it with
blitEntityFrame(0, 0, 2, entity.frame[2], screen);

should that work?


Have you tried...

int player;
player=entitySpawn(0,0,"test.chr");
blitEntityFrame(0, 0, player, entity.specframe[player], screen);

... That should work, or at least it does for me. But then again, I implemented my own animation system to animate things from a side-scrolling view.

Posted on 2004-05-24 18:00:31

rpgking

Do this:

Somewhere in the startup of your map, set up all the map entities' rendering to be hooked to one function:


for(e=0; e<entities; e++)
HookEntityRender(e,"dwl_IdleMove");


Here's part of what goes in to dwl_IdleMove():


BlitEntityFrame(dwl_EntityScreenX(event.entity),dwl_EntityScreenY(event.entity),event.entity,
entity.face[event.entity]-1<<1+(timer/(DWL_FRAME_SPEED-player_speed_offset)%DWL_FRAME_WALK_COUNT)
,screen) ;


The important thing here is that all the entities are rendered using the dwl_IdleMove() function, and the specific entity being referenced at a given time by the entity rendering function is always going to be "event.entity".

Using this information, you can render every map entity using a custom rendering function. This is the method I use for custom animation for all map entities, and it works fine.

Posted on 2004-05-24 23:18:35 (last edited on 2004-05-24 23:27:55)

vecna

Well I'm glad the whole hookentityrender/blitentityframe thing was useful, seems like a lot of people are making use of it.

The invalid frame request on the first blit thing seems weird, I'll look into it, it may just not be being initialized correctly or something.

Posted on 2004-05-24 23:40:37

RageCage

turns out I was trying to access ouside of the entity array, sry about that. thx yall

Posted on 2004-05-25 01:08:40


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