Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Filipe on Tue 26/02/2019 22:57:56

Title: Character Animation Without Walking - in the same position
Post by: Filipe on Tue 26/02/2019 22:57:56
Hi guys :)

I know I'm just a beginner, but I envision this game, and I think that with your precious help I can do it :)

I want to animate my playable character but in the same position, without walking, I mean, and without being a cut scene... So, here is what I want to do:

I want my character to seat on a chair, after we tell him to do it, with the action click... then, I want the same character to do different things, on this new seated position, like changing the TV channel, reading a book, etc...

So, here is how I though I could this. I just want you guys to tell me if this is possible, to make suggestion, and also to tell me which are the instructions, I should use... (e.g - I don't know the instruction to make the character invisible :()

I though that after I click on the chair, the character walks to a certain positiion, and its visiblility turned to "false" (is it possible to do it?), but with the all the actions visible, so I could tell the character, what to do after he sat on the chair... then I turn the visibility of an object, on the same starting position where my character was,  to true (the object is an animation of my character  seating on the chair) . Then, If I click on certain objects the character performed certain animations with different objects (like reading a book, etc), If I click with the walk action to an area, outside the chair, I turn visible an object animation of my character getting up, and then the playable character turns visible again, and everything turns to normal again...

So, is it possible to do what I want like this? Is there a better way of doing this? Can you tell me which instructions should I use to do this?

Many thanks :)


Title: Re: Character Animation Without Walking - in the same position
Post by: Khris on Tue 26/02/2019 23:09:40
You don't need to switch to an object, that's what Character.Animate() is for. If you look at the documentation for that command you'll also find example code that shows how to lock the character to a certain view first. (Create separate views for all the animations; don't put them in the Character's main view.)

If you create a room variable (just add bool playerInChair = false; to the top of the room script) you can keep track of the character's state. Set the variable to true when the player sits down, and check its value in interactions to decide what to do.
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Tue 26/02/2019 23:31:34
Thanks Khris... I already did the animations, on different views. Can you put  a link to the character.animate()? I have difficulty finding some instructions on the manual :(
Also, do I need to change my character view first?

https://www.adventuregamestudio.co.uk/w/index.php?title=Special%3ASearch&search=character.animate%28%29&go=Go
Title: Re: Character Animation Without Walking - in the same position
Post by: Khris on Wed 27/02/2019 00:11:12
The online manual is here: https://www.adventuregamestudio.co.uk/manual/
Here's the page: https://www.adventuregamestudio.co.uk/manual/ags47.htm#Character.Animate (including how to use the command)

The manual is also available from inside AGS, just press F1.
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Wed 27/02/2019 00:43:56
Thanks again Khris...

But I have to make the character walk to a certain position, otherwise he seats o the floor right? Also, how does AGS adjust scaling? Should I scale the same way as the character?

One thing that was really handy, was a graphic editor on AGS... It is so time consuming to have to go to photoshop to sometimes do a minor  adjustment on the sprite :( Also can we zoom the sprites? It is so small, that it is sometimes difficult to see the frames...
Title: Re: Character Animation Without Walking - in the same position
Post by: ManicMatt on Wed 27/02/2019 08:08:24
I think scaling is covered in the manual..

I hit ctrl and + to use the zoom feature in Windows if I'm struggling to see something.
Title: Re: Character Animation Without Walking - in the same position
Post by: Khris on Wed 27/02/2019 08:10:01
Not sure what you're asking. Just make the character walk to the position first, using eBlock. Then use LockView and Animate to show them sitting down.
If you make the sit down sprites wide enough, you don't need to reposition the character at all. A character sprite is drawn with its bottom center at the character's x/y position, so keeping that in mind, you can adjust the sprite's canvas so the character's pivot remains the same.
If you do this, the same scaling will apply throughout, and everything will work out fine.
Title: Graphic Editor on future AGS versions
Post by: Filipe on Wed 27/02/2019 10:38:45
Thanks...

Khris, do you know if there is any graphic editor planned to be included on future AGS versions?

Or at least the ability to make minor adjustments to the graphics, like saturating colors, turn sprites to black-and-white, framing sprites right, or the ability to zoom the sprites...

For instances, I found my graphics color's to be not very saturated. Now I have to edit them again on Photoshop. The problem is that I have to do this frame by frame, or sprite by sprite, don't I? Is it possible to open all the sprites used in a view in photo shop at the same time? Or zoom them? OR I have to go trhough the painful task of having to open them individually? Is it possible to export AGS sprites to different layers in Photoshop, at the same time?

What I want was a Photoshop inside AGS... is it to much to ask for?  :grin: LOL
Title: Re: Character Animation Without Walking - in the same position
Post by: Khris on Wed 27/02/2019 11:22:06
Yes, it's too much to ask for. Primarily because it's not necessary at all. Color and contrast choices should happen during the design phase, not while you're implementing animations.

Load a room background into a layer, then your character sprite into another layer. Now edit the sprite until you're satisfied.
When you're done, then is the time to create tons of animation frames based on it.

Still, AGS supports tiled sprite import. Use a sprite sheet (that way you can make coloring adjustments to all sprites at once), then import them all at once into AGS using the option in the sprite import dialog.

You don't need Photoshop inside AGS (which isn't going to happen any time soon, or ever), you simply need to fix your workflow.
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Wed 27/02/2019 11:36:32
Thanks Krish... I guess you are right... but... sometimes you just change your mind whit the development of the game... imagine you want your game to get darker, or colors to get de-saturated, when your character is dying... or you want to do a cut scene in black and white, so it gives the impression of a flash back... I mean it was handy to do minor adjustments to your sprites without having to go to Photoshop...

Anyway, you really help me a lot... again... I'm already implementing your advices, and they are working....

Thanks  :)
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Wed 27/02/2019 12:07:54
Quote from: Khris on Wed 27/02/2019 08:10:01
Not sure what you're asking. Just make the character walk to the position first, using eBlock. Then use LockView and Animate to show them sitting down.
If you make the sit down sprites wide enough, you don't need to reposition the character at all. A character sprite is drawn with its bottom center at the character's x/y position, so keeping that in mind, you can adjust the sprite's canvas so the character's pivot remains the same.
If you do this, the same scaling will apply throughout, and everything will work out fine.

Khris, what I mean with the scaling thing is this: do I use the same scale of all my normal character view sprites, or should I scale down this new seat view so it matches the place where he starts the seating animation? Because I'm using the scale feature of AGS, so when the character seats he is probably 80% of its original size... Thanks again :)
Title: Re: Character Animation Without Walking - in the same position
Post by: Khris on Wed 27/02/2019 12:16:50
Create your in-chair sprites at 100%, as if your game had no scaling at all.
The character's in-game scaling will always apply to its current sprite, so regardless of the view or frame, the sprite will appear downscaled according to the current walkable area scaling.

The only reason to do things differently would be if you were creating a lowres game and you want the chair animations to be pixel-perfect. In that case you'd create them at the final size (i.e. 80% of the character's actual size), then disable scaling while they're in the chair.

As for character effects, AGS has ways to achieve that in game. You could for instance use Character.Tint(), or display a non-clickable semi-transparent black GUI across the screen to darken/tint the entire scene.
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Wed 27/02/2019 13:48:26
Thanks Khris :) I guess I have a lot to learn from you guys :) I love AGS :)
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Wed 27/02/2019 21:21:41
Quote from: Khris on Wed 27/02/2019 12:16:50
Create your in-chair sprites at 100%, as if your game had no scaling at all.

As for character effects, AGS has ways to achieve that in game. You could for instance use Character.Tint(), or display a non-clickable semi-transparent black GUI across the screen to darken/tint the entire scene.

Khris, how exactly do you use character.tint()? If you want to affect only saturation, what should one do? I mean, I want the same RGB colors levels, but I want to increase saturation only. So what should I do? If you  do cEgo.Tint(0, 0, 0, 30, 100) what does it do? I know that for luminance to be the same one should choose 100, what about RGB? Is it zero, or 250/2?

Thanks
Title: Re: Character Animation Without Walking - in the same position
Post by: Khris on Wed 27/02/2019 23:24:36
I don't think you can increase just the saturation; the saturation parameter is only used to specify how much of the RGB gets applied.

If you want to change the saturation of the character in-game, you can create highly saturated sprites, then tone them down in-game using a tint like (128, 128, 128, 50, 100), which should apply 50% medium gray to the sprite. Remove the tint to turn the character saturated again.

As far as I can tell, the Tint() command is mostly intended as a way to implement colored light sources; it's very possible that it doesn't support the thing you want it to do.

Having said that, you can in theory create a fully custom colored dynamic sprite based on an imported one; a suitable function could grab the frames of a view, iterate over the pixels and create new sprites. Doing this once per frame is probably going to slow down the game though, so whether this is feasible depends on how and when exactly you want the saturation to change, and on whether the character is supposed to be moving while you're doing it.
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Thu 28/02/2019 00:43:46
To tell you the truth I want to match the saturation of some of my first sprites animations. Why? Because I forgot that I had saturation to 40 in photoshop on those first animations. Then I noticed that with the new animations I already have done, and imported to AGS, the sprites look less saturated :( I'm just lazy to import all the sprites of those new animations again into AGS, this times with Saturation turned to 40.... :(
Title: Re: Character Animation Without Walking - in the same position
Post by: Matti on Thu 28/02/2019 07:43:16
Well, don't be lazy and don't forget the steps in your image editing process ;)

But as a note: If you don't change the filenames you can quickly re-import all the sprites at once using "import from source".
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Thu 28/02/2019 08:14:39
Ok Matti, I won't :)
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Fri 01/03/2019 09:26:01
Quote from: Matti on Thu 28/02/2019 07:43:16
Well, don't be lazy and don't forget the steps in your image editing process ;)

But as a note: If you don't change the filenames you can quickly re-import all the sprites at once using "import from source".

Matti, can you at least adjust the character brightness/contrast? I mess around with the tint properties, and I really don't understand... it seems to have a mind of its own ;) LOL Thanks :)
Title: Re: Character Animation Without Walking - in the same position
Post by: Cassiebsg on Fri 01/03/2019 13:03:36
I'm guessing you can create a macro in photoshop, open the files, run it and change those things automatic, save the files overwriting your old ones. Then just select the sprites you wish to replace, right click, select "replace from source" and *bingo* it's done.
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Fri 01/03/2019 22:16:53
Quote from: Cassiebsg on Fri 01/03/2019 13:03:36
I'm guessing you can create a macro in photoshop, open the files, run it and change those things automatic, save the files overwriting your old ones. Then just select the sprites you wish to replace, right click, select "replace from source" and *bingo* it's done.

Thanks a lot... I just wish that AGS offered at least two things:

1st: the ability to zoom the frames/sprites... I think, if you can zoom the room, why not the sprites? It ease my work so bad..
2nd: the ability to export frames from a view to multiple layers in photoshop, or at least the ability to open them at the same time...

Any way, Cassiebsg, can I ask you and the rest of you guys some more things?

Is it possible to copy a loop to another view? Is it possible to copy a view? To another view? Or to duplicate it?
Also, can I change the loop from the speech view? How? I know I can change the view... what about the loop? I'm saying this because I have my character seated, and I want him to speak, with different animations, loops. He is seated so when the character is speakinh he is alyways using the first loop (loop zero). Is the solution only to do 3 different speech views, each one, with its own loop? 

Thanks :)
Title: Re: Character Animation Without Walking - in the same position
Post by: Matti on Fri 01/03/2019 23:21:15
You can use Character.Loop to change a character's loop  ;) You can copy and paste loops by right-clicking it. I don't think you can copy views though.
Title: Re: Character Animation Without Walking - in the same position
Post by: Cassiebsg on Fri 01/03/2019 23:34:58
the 1st question: I find my self wishing that too, since sometimes it's a bit hard to see what is what. so I just make sure my frames are properly ordered...
2nd: Open photoshop, open the first frame, select the others and drag them inside the open frame. Works just fine for me.

3rd: Yes, you can copy a loop. Just right click the loop you wish to copy and select "copy", then go to the loop you wish to paste into and select "paste loop over this loop" (or something like that. You can even paste it flipped. (Like if your right view only diference to the left view is the flipped frames). You need to have at least one frame in the loop created to be able to paste in it.
Can't remember if it's possible to copy/duplicate a view. But don't think so.

Not sure about changing the loop. But you can "force" it to change the loop.
Let's say that loop 0 (facing down) you have one speech loop (normal) with the character sitting facing down. Now you could put another facing down loop in loop 1 with a diferent speech type (maybe serious). And another with him smiling in loop 2. The when you want him to be serious just tell him to FaceDirection(eDirectionLeft), or character.Loop=1.... and face right or set it to 2 to smile.

I would then make a function where I could just type SpeechSitting(normal); SpeechSitting(serious); SpeechSitting(smile);  or what ever is that would make it easy for you to code later on...  ;)
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Sat 02/03/2019 00:29:16
Thanks MAtti, and Cassiebsg :)

I'm also a fan of Galactica, Cassiebsg ... I love your Avatar, Muffit :)

I also  love Space 1999, V - Visitors, The Black Hole, or "O Abismo Negro ;)"... I love Sci Fi :)
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Fri 08/03/2019 09:23:12
I got it...
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Fri 08/03/2019 11:18:45
Quote from: Matti on Fri 01/03/2019 23:21:15
You can use Character.Loop to change a character's loop  ;) You can copy and paste loops by right-clicking it. I don't think you can copy views though.

Hi Matti... can you change the loop in the speech view? How? Thanks
Title: Re: Character Animation Without Walking - in the same position
Post by: Matti on Fri 08/03/2019 13:23:18
Just set Character.Loop = x and the character changes the loop within the current view.
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Fri 08/03/2019 14:09:26
Quote from: Matti on Fri 08/03/2019 13:23:18
Just set Character.Loop = x and the character changes the loop within the current view.

Thanks Matti. :) By the way, can you unser me another question? It is possible to reverse the order of the frames of a loop? You copy a loop in a way the frame order is reversed... Imagine I want to use the same frames so that the character get up or seat in a chair...
Title: Re: Character Animation Without Walking - in the same position
Post by: Khris on Fri 08/03/2019 14:16:59
The Animate command has a direction parameter. Just use eBackwards.
Title: Re: Character Animation Without Walking - in the same position
Post by: Filipe on Fri 08/03/2019 14:44:41
thanks Khris... I'm realy newbe :(