Feature Suggestion - Extra .CHR Animations
Displaying 1-20 of 24 total.
12
next
torin
|
Hey All,
I'm working on this game, and the characters need to do more than walk around (they should be able to wave their arms and shout, bang their head against a wall, etc.).
Now, while I *could* do all this with special frames (I'd most likely end up writing my own VC movement script interpreter), it seems more logical and consistent to do it in the same way walk animations are done.
So might I suggest allowing CHRs to contain more than the four walk animations, and having an EntityAnimate() function or some such that takes the name of an animation as a string and plays the given animation for an entity.
Oh, and any suggestions regarding how to do this with the current engine would be most appreciated!
Thanks.
-- torin
Posted on 2004-07-05 13:22:46
|
Zip
|
HookRetrace:
if (!entity.movecode[your_entity]) entity.specframe[your_entity] = idle_frame;
else if ((entity.face[your_entity] == 1) && (entity.y[your_entity] % 16 < 2) entity.specframe[your_entity] = up_frame_a;
else if ((entity.face[your_entity] == 1) && (entity.y[your_entity] % 16 < 4) entity.specframe[your_entity] = up_frame_b;
etc...
By the way, this is horrible hacky fix and may not work nicely. So I second your feature request, (custom animations for the entity you can set too maybe?) and also add that I want access to the .chr graphics at runtime, PAPER DOLL!
Rar
[Edit: Bollox, thought that greater than, less than thing had been fixed]
Posted on 2004-07-05 16:14:45 (last edited on 2004-07-05 16:40:51)
|
Overkill
|
Here's my suggestion of how to go about it:
#define ANIMATION_WAVE 24
#define ANIMATION_WAVE_FRAMES 3
#define ANIMATION_WAVE_DELAY 10
#define ANIMATION_BLINK 27
#define ANIMATION_BLINK_FRAMES 2
#define ANIMATION_BLINK_DELAY 30
void EntitySetAnimation(int e, int anim, int frames, int delay)
{
int f;
f=anim+(timer/delay%frames);
entity.specframe[e]=f;
}
Posted on 2004-07-05 17:29:32
|
vecna
|
Am I missing something? Just use a movescript with frame commands and waits. It would be almost identical to a chr animation script except with Z commands instead of F. Is there a reason that wouldn't work?
Posted on 2004-07-05 17:41:42
|
Zip
|
Is there a reason that it isn't documented? Can you give some example code?
Zip
[Edit: *it* and MOAR code]
Posted on 2004-07-05 17:48:39 (last edited on 2004-07-05 18:14:34)
|
vecna
|
Z in movestrings was documented in V1 and V2. V3 documentation just isn't finished yet.
EntityMove(theentity,"Z10W50Z11W50Z14W50"); or something would do .. something.
Look at sully, in cottage.vc when darin first enters the map.
Posted on 2004-07-05 18:32:48
|
rpgking
|
Quote:Originally posted by Zip and also add that I want access to the .chr graphics at runtime, PAPER DOLL!
Rar
Isn't that what this function is for?
void BlitEntityFrame(int x, int y, int e, int f, int dest)
I made idle entity animations using this(where entities appear to walk even when they're stopped...due to the style of my game), and it should be fairly easy to extend this concept to a paper doll system.
Posted on 2004-07-05 18:40:51 (last edited on 2004-07-05 18:43:52)
|
Zip
|
Wicked, that's gonna be very useful. Can slim my hookrender down again. Any chance of getting pixel movement working for it though? To do what Torin wants you'd want:
EntityMove(theentity,"PZ10L2Z11L2Z14L2"); // and so on...
And while you're in a talkative mood, loading .chr graphics and tilesets at run time? :D
Zip
Posted on 2004-07-05 18:44:02
|
Zip
|
Quote:Originally posted by rpgking
Isn't that what this function is for?
void BlitEntityFrame(int x, int y, int e, int f, int dest)
*sigh*
Right, what does that one do? Overright on of the frames in the .chr with something you spec? So:
BlitEntityFrame(?newframex, ?newframex, entity, newframeimage, framenumber);
?????? Or just blit a frame to screen?
Why do you people know all this shit and not put summat in the docs?
Zip
Posted on 2004-07-05 18:48:41
|
rpgking
|
It just blits a frame to the screen. So it's actually
BlitEntityFrame(screen x position, screen y position, entity index, frame number, destination image);
I learned about this function from one of vecna's past posts.
As always, if you add this to a HookEntityRender(), you can get the current entity being referenced using event.entity.
void PaperDollRender() //add to a HookEntityRender
{
//Blit current frame of the entity being referenced
BlitEntityFrame(x, y, event.entity, frame_index, screen);
//Blit Paper Doll Stuff
}
void HookEntities() //Hook all current map entities to PaperDollRender
{
int e;
for(e=0; e<entities; e++)
HookEntityRender("PaperDollRender");
}
I might have provided more info than you needed, but hope that cleared up the functions of BlitEntityFrame and HookEntityRender. :P
Posted on 2004-07-05 19:01:02 (last edited on 2004-07-05 19:02:10)
|
torin
|
Thanks, vec. I don't know why I didn't think of that. I guess I forgot about movescripts alltogether.
Is there a way to make the entity move in a movescript? For example, if you had a got_punched animation and you want him to fly backwards a couple of tiles while playing a sequence of special frames, could that be done entirely with movescripts? Or would the movement have to be done separately?
-- torin
Posted on 2004-07-05 19:37:42
|
Zip
|
Ta, rpgking, added to docs. I'll beed to experiement a bit and update what I've got currently when I know what's going on.
Torin: Yeah, eg:
EntityMove("Z24L2Z12");
Sets the frame to 24, the move left 2 tiles, then sets the frame to 12. There should be a way of doing pixel perfect moves too, but it appears broke atm.
(To fly 'backwards' you'd want to look at entity.face[ent_num] and decide what direction to move from that)
Zip
Posted on 2004-07-05 19:53:11
|
rpgking
|
Just read what you wrote, and you're right about auto-transparency. I tried blitting a translucent entity using SetLucent(), and it worked perfectly too :D
Posted on 2004-07-05 21:42:02
|
blues_zodiakos
|
It'd be nice to be able to add diagonal movement animations without the insanity. :D
Posted on 2004-07-07 19:58:40
|
rpgking
|
I thought it was mentioned once by vecna that he's gonna add diagonal movement animations. I could be wrong though...
Posted on 2004-07-07 20:00:12
|
Interference22
|
Z movescripts! I forgot they even existed! I've been using bloody specframe! Damn! That makes things MUCH easier!
Posted on 2004-07-07 23:18:16
|
vecna
|
yeah I was gonna add diagonal movescripts in real quick but then I remembered I should go ahead and add diagonal walk animations too while im at it so it got delayed a bit.
Posted on 2004-07-08 02:56:41
|
Gayo
|
Oh, that reminds me. Would it ever be possible to have jumps in movescripts? Like, say, you could put "L1" in a movescript, and then "J1" would jump you to L1, and so on. This would allow some pretty neat things, since you could loop only the end of a script.
Posted on 2004-07-09 03:18:01
|
torin
|
Why not go one step further? Use full-fledged functions instead of movescripts. Make them co-routines, so when you call certain built-in functions('wait', 'moveLeft', etc.), you return control to the engine until the entity completes that action.
script GuardScript () {
while(1) {
moveLeft(2); // Entity ID is implicit or optional
wait(4);
moveUp(2);
wait(4);
moveDown(2);
wait(4);
moveRight(2);
wait(4);
}
}
You could have special conditions, too. An 'on' block would execute whenever the associated condition became true while the enclosing block was executing. Once the 'on' block was done, execution would continue from the point in the enclosing block where it left off.
script GuardScript (int idx) {
while(1) {
on (guards[idx].alert) AlertGuardScript(idx);
on (guards[idx].knocked_out) {
specialFrame(4); // Knocked out picture
wait(guards[idx].knock_out_interval);
noSpecialFrame();
}
moveLeft(2); // Entity ID is implicit or optional
wait(4);
moveUp(2);
wait(4);
moveDown(2);
wait(4);
moveRight(2);
wait(4);
}
}
You could also call scripts from other scripts. So 'moveLeft', 'wait', etc. become built-in scripts.
script clockWiseCircle (int radius)
{
moveUp(radius);
moveRight(radius);
moveDown(radius);
moveLeft(radius);
}
script counterClockwiseCircle (int radius)
{
moveRight(radius);
moveUp(radius);
moveLeft(radius);
moveDown(radius);
}
script guard ()
{
while(1) {
clockWiseCircle(4); // circle of radius 4
clockWiseCircle(4);
counterClockwiseCircle(4);
counterClockwiseCircle(4);
}
}
You could still have regular movement scripts, because they're more brief, but treat them like a special notation for scripts.
What do you think?
-- torin
edit: fixed a bug, better variable names
Posted on 2004-07-12 14:43:04 (last edited on 2004-07-12 14:54:58)
|
Gayo
|
That would be pretty cool, but it means you'd have to define a separate function for every unique movecript, and a full game will have hundreds of movescripts. Also, it fails the "would vecna ever actually implement this" test, sadly.
Posted on 2004-07-12 15:08:38
|