Animated Character in Background, how?

Started by EliasFrost, Sat 20/06/2009 11:11:54

Previous topic - Next topic

EliasFrost

Hi everyone! This is my first ever post on these forums and it's unfortunately a call for help. The thing is that I want to have a character constantly animated in the background, but I can't seem to get it working straight. I've tried using every of the views (Idle, blink, normal etc.) but I just can't get the animation to play constantly, instead of one time every ten second of so (using idle view).

I am a very basic scripter since I just started using AGS a week ago, so if there are any scripts included to solve the problems, It would be very appreciated if the script is commented.  :)

Thanks in advance, I look forward for a fun time together on these boards!

// Frostfalk

GuyAwesome

#1
Two options, neither of which are actually that complicated to pull off:

1) Go back to using the Idle view, but change the delay before it starts to 0. This can't be done in the editor, so you'll have to use Character.SetIdleView in the game script (e.g. when you enter the room the character is in). Use it like
Code: ags

cNpc.SetIdleView(3,0);


2) Use Character.Animate, set to non-blocking, repeating animation.
Code: ags

cNpc.ChangeView(3); // If you want to use the character's normal view, you can leave this line out. Or use .LockView and .UnlockView, if you want the character to use their normal view later...
cNpc.Animate(cNpc.Loop, 3, eRepeat, eNoBlock); // Will animate the character with their current loop, repeatedly
// Play around with the 'delay' parameter (3 in this case) to get the speed right

Again, when the player enters the room is a sensible place for this.

Both of these functions are in the manual, and don't really require advanced scripting to use as you want (The SetIdleView entry even mentions this exact use...). Without meaning to be rude, you should be reading through the manual a bit more thoroughly before posting  :)

EDIT after Monkey_05_06:
Dude, pseudo-code, doesn't have to be accurate. I was actually thinking of Character.ChangeView but OK, altered in the interests of clarity.

EliasFrost

Thanks GuyAwesome, I don't know why I didn't think of that before. I took a quick look in the manual before posting, I guess I should read more carefully next time. :)

monkey0506

#3
Regarding the Character.Animate route, the proper name of the "Character.SetView" function is Character.LockView which is used to temporarily change the Character's view, as you would do when animating.

If you want to permanently change the Character's "normal"/walking view, you would then use Character.ChangeView.

After the animation is completed you would then use Character.UnlockView to stop the animation and restore the Character back to their normal view.

Quote from: GuyAwesome on Sat 20/06/2009 12:11:18Without meaning to be rude, you should be reading through the manual a bit more thoroughly before posting  :)

Without meaning to be rude, you should make sure you use the appropriate function names so nobody gets confused! :P

EDIT: (after GuyAwesome's edit), I wasn't trying to be rude there and I definitely understand pseudo-code doesn't have to be something that is capable of being compiled. But ambiguity can be a major hindrance to new AGSers and especially to new scripters. Frost did say this particular character is going to only have one view anyway, but it's still important for everyone else reading this (especially users who may be searching the forum for assistance later on) to understand what you mean. That was the whole reason I posted was just to try and clarify the ambiguity for Frost's (and posterity's) sake. ;)

EliasFrost

The character that's going to use this constant animating only have one view anyway, but thanks Monkey_05_06, I'm sure that will come in handy soon! :)

SMF spam blocked by CleanTalk