Setting IdleView to face the screen.

Started by Brian925, Sun 04/02/2024 07:05:19

Previous topic - Next topic

Brian925

I have a character who moves in four directions, but when IdleView kicks in, it forces him to face forward.

I do this by creating a Walking View with 4 loops that each represent one of the four cardinal directions. (Loops 0(Down),1(Left),2(Right),3(Up). No IdleView set.

I have an additional, separate View for IdleView (instead of just setting the sprite in the character) that has only 2 frames of the same character closing his eyes, facing forward on Loop 0.I did it like this because setting the BlinkView did nothing when I assigned a sprite to it, so I used IdleView to achieve the same effect.

I did NOT place IdleView sprites in the Left, Right or Up loops, and that has forced it to default back to the front facing walk cycle loop.

That worked until it didn't. I'm suddenly getting the error message: AnimateCharacter: invalid starting frame number specified.

Is there a simpler way? Could something in my code prevent BlinkView from working?

Thanks for any help.





Danvzare

The blink view is used for the Serria portrait style of talking, to make the characters blink while talking. I presume you have it set to the default LucasArts style (aka, the dialog appears above the character's heads).

If you want the character to continue to face the same direction when they enter their idle view, you'll need to setup the other loops. Although judging by what you've written, it sounds like you wanted him to face downwards whenever the idle animation plays. I'm just telling you, in case I've misunderstood.

As for the error message, it sounds like something else in your code is causing an issue. You should probably look at your code, specifically anything that you've added or changed recently related to animations. You seem to be referencing a frame number that doesn't exist (you've probably written a 1 in, without realizing that frames start at 0).

Brian925

All good insight. I've recently imported a Tween module that I'll dig through to see if it's conflicting with any of my code. I also started making my game in an earlier version of AGS, and it had to rewrite the code to make it work with 3.6. I'll keep exploring.

RootBound

Quote from: Brian925 on Sun 04/02/2024 14:14:08I've recently imported a Tween module that I'll dig through to see if it's conflicting with any of my code.

The tween module from these forums shouldn't interfere with anything unless you're writing your own tween code elsewhere and using the same names for things (which still shouldn't affect character views at all). It's self contained. It just adds extra commands and functionality that you can call when you want it.
They/them. Here are some of my games:

Brian925

Quote from: RootBound on Sun 04/02/2024 14:35:39
Quote from: Brian925 on Sun 04/02/2024 14:14:08I've recently imported a Tween module that I'll dig through to see if it's conflicting with any of my code.

The tween module from these forums shouldn't interfere with anything unless you're writing your own tween code elsewhere and using the same names for things (which still shouldn't affect character views at all). It's self contained. It just adds extra commands and functionality that you can call when you want it.

Okay, that makes sense.
I have the old KeyboardMovement module installed too that I recently set to Pressing instead of Tapping, and then upgraded from 3.4 to 3.6 AGS. It told me it needed to update the code and it wouldn't be backward compatible. Could that be it?

RootBound

Quote from: Brian925 on Sun 04/02/2024 15:02:36I have the old KeyboardMovement module installed too that I recently set to Pressing instead of Tapping, and then upgraded from 3.4 to 3.6 AGS. It told me it needed to update the code and it wouldn't be backward compatible. Could that be it?
I doubt it, but I haven't used that module so I don't know for sure.
They/them. Here are some of my games:

Brian925

It's only when the character is facing left or right, not up or down.
What part of the code handles the IdleView? I didn't see anything in the global script that could have specifically ruined the left and right IdleView but not the Up and Down.

Khris

Are you properly locking the view before manually animating the character?
Can you show the code that causes the error?

Also, I'd place the front-facing idle sprites into the other three loops of your idle view for now; a good rule of thumb to avoid frame related errors is to put at least two frames in each of the first four loops for all views that are used as normal, speech or idle view.

Brian925

I'll definitely explore that and check back in. There's a lot of character views to dig through, I'll check on all the locking and see where the error might be.

SMF spam blocked by CleanTalk