Parenting a Head

Started by Armageddon, Wed 23/05/2012 08:47:18

Previous topic - Next topic

Armageddon

So I was replaying Monkey 2 Special Edition today and I noticed something interesting, I always wondered why they made the head sprite separate from the body. So I was playing swapping back and forth between new and old. I noticed in the new edition if you look at something and walk around your mouth won't animate as your talking because it's playing the walking animation. But in the original your mouth continues to move as you walk. I was wondering if this is possible to do in AGS? It would be even more helpful since you change clothes in my game I wouldn't have to animate stuff like talking every time. I guess a simple way to do it would be to have another character exactly follow the player character, but that seems a little hacky.

Thanks! ;-D

Ghost

#1
Not hacky at all; sounds like the best approach. Many a game uses similar techniques; a Diablo2 character is just a shitload of armour/weapon layers... whith a head  :P

I *wanted* to do something similar in RamGhost (to have different heads for the character). The only different thing would be finding a good "cut line"- if the character has
clothes that shift during the animations, you'd either have to make the head change z axis to account for that, or take care that there's no overlapping.

Armageddon

I'll try it out soon then.

Another question, is AGS cross platform yet? I really need my game to work on Linux and Mac. I saw a Mac port in the Engine Development thread but it still looked fairly broken.

Armageddon

That was a dumb question. :=

Now I have a font issue. I imported a regular font and an outline font, the problem is they both have to be different sizes to fit into each other and for some reason it looks like this.


Chicky

I've often thought about this, i always figured that having another character act as the head was just my lazy logic, and that there would be a far more suitable method. - Thanks for clarifying this Ghost/Armageddon!

It reminds me of the way i've scripted random rain splashes in my game, i've simply got 30 objects in a room that randomly appear across a region, then animate and move somewhere else. It's scripted in thirds, so 1-10,11-20 and 20-30. Looks perfect but is totally ass-backwards. I need to learn more about the raw draw function.

P.S. Cool astronaut!

Khris

#5
The astronaut is old The Dig concept art, afaik.

Armageddon, try these two fonts: https://www.dropbox.com/s/4ujiansa6oegg61/outline_font.zip
You can also use just one regular font and try switching the OutlineStyle setting to automatic.
The fonts don't really have to be different sizes btw; if they are bitmap fonts, the characters in fact need to be the same size.

Armageddon

Quote from: Khris on Thu 24/05/2012 19:45:11
The astronaut is old The Dig concept art, afaik.

Armageddon, try these two fonts: https://www.dropbox.com/s/4ujiansa6oegg61/outline_font.zip
The fonts don't really have to be different sizes; if they are bitmap fonts, the characters in fact need to be the same size.
Yes it is the pre-alpha Dig astronaut, just for placeholder. :P

Okay so I made a second character for the head and used this.

Code: ags
cJack_Head.FollowCharacter(cJack, FOLLOW_EXACTLY, 0);


It works perfectly except when the player walks the head doesn't turn, I made a 'walking' VIEW for it that has it flip when you walk left and up just like I did for the astronaut. But it's like the head character isn't actually following anymore it's more like a floating sprite.

The fonts are .TTFs which may be the problem, I'd really wish I could use them, all the letters should be the same size. I'll try out your font.

And how do I make a GUI black, background image won't loop and 0 is transparency? :-[

Thanks guys!

Khris

I never tried it myself but in another thread about FOLLOW_EXACTLY I think we found out that you have to set the loop manually.
Code: ags
// inside repeatedly_execute_always
  cJack_Head.Loop = player.Loop;


For the GUI, use "almost black":  0; 4; 0

Armageddon

Thanks that worked, I used your font but it has a few different things from mine so I'll try and figure a way of fixing mine. Thanks everyone!

Armageddon

Still can't fix my font, but I was wondering if anyone knows how to do color swapping in AGS? Or should I do it by hand and import each frame.

Khris

What exactly do you mean by that? Do you want to change a single sprite's color to something else?
You could iterate through each pixel, get its color value and draw over it if it's the one you want to replace. Could be slow for big sprites though.

In an 8-bit color game, you have complete control over the palette, btw.

Armageddon

I think I'll try making an 8-bit game, but a couple of questions.

I know I can set a few 'gamewide' colors for all the sprites and characters that will never change. But then how do I add background colors without adding in all 245 of them? Can it auto detect what colors are in the background?

Also when I run it in 8-bit it changes the windows theme back to classic (like it did with older versions of AGS) until I close the game, is there anyway to fix this?

Armageddon

Looked it up a bit and it does auto-detected when importing backgrounds, I already had mine imported so had to re-import. But the changing Windows themes is still a very large issue.

Khris

Judging from your screenshot, maybe an 8-bit game isn't such a good idea; you'll lose all transparency effects for instance.
Also, running a 256 color game in Win7 will switch the display mode, I don't think there's an easy workaround for that (other than running it in a VM).

If all you want is change a sprite's color, maybe sticking to 16-bit is not that bad.

Armageddon

The transparency was just a test, but I guess I'll stick with 32-bit and fake color cycling. I wonder why it has to switch themes though.

Khris

I guess a game that runs windowed at 8-bit forces the Desktop down to 256 colors, too, and Microsoft didn't want their fancy transparency stuff to look bad, so they made Windows auto-switch the theme to the Classic one which still looks ok with only 256 available colors.

Armageddon

#16
Alright, thanks Khris. I think I'll just stick with 32-bit and fake it by setting a palette for myself.

Now I'm working on a basic SCUMM GUI.



I'm having a lot of problems with the text speed stuff.

1. I use the sliders value to set the Game.TextReadingSpeed, the problem is the game crashes when I set the slider to 0 because text speed 0 doesn't exist,. Also if I set the slider to the max it's still very slow.
Code: ags
function Text_Slider1_OnChange(GUIControl *control)
{
  Game.TextReadingSpeed = Text_Slider1.Value;
}

My slider is set to a max of 10 like the other ones.

2. So I have this code to toggle the button and graphic and stuff, I'm not sure if I did it right.
Code: ags
function Speech_Button1_OnClick(GUIControl *control, MouseButton button)
{
  if (Speech_Button1.Text == " ")
  {
    SetVoiceMode(eSpeechVoiceOnly);
    Text_Slider1.Visible = false;
    Speech_Button1.Text = "";
    Speech_Button1.NormalGraphic = 20;
    Speech_Button1.MouseOverGraphic = 20;
  }
  else if (Speech_Button1.Text == "")
  {
    SetVoiceMode(eSpeechVoiceAndText);
    Text_Slider1.Visible = true;
    Speech_Button1.Text = " ";
    Speech_Button1.NormalGraphic = 19;
    Speech_Button1.MouseOverGraphic = 19;
  }
}

But I have to click it twice to disable it the first time I start the game. I'm not really sure why. Also the text doesn't turn off when it's disabled, do you need a speech.vox for that to work?

3. How do I change the mouse cursor when the menu is open?

Thanks.

monkey0506

Quote from: Armageddon on Wed 30/05/2012 00:09:04I'm having a lot of problems with the text speed stuff.

1. I use the sliders value to set the Game.TextReadingSpeed, the problem is the game crashes when I set the slider to 0 because text speed 0 doesn't exist,. Also if I set the slider to the max it's still very slow.
...
My slider is set to a max of 10 like the other ones.

You do realize you can set min and max slider values in the editor, yes? Just set the min to 1 and the max to something higher, say 30 (which is double the default speed).

Quote from: Armageddon on Wed 30/05/2012 00:09:042. So I have this code to toggle the button and graphic and stuff, I'm not sure if I did it right.
Code: ags
function Speech_Button1_OnClick(GUIControl *control, MouseButton button)
{
  if (Speech_Button1.Text == " ")
  {
    SetVoiceMode(eSpeechVoiceOnly);
    Text_Slider1.Visible = false;
    Speech_Button1.Text = "";
    Speech_Button1.NormalGraphic = 20;
    Speech_Button1.MouseOverGraphic = 20;
  }
  else if (Speech_Button1.Text == "")
  {
    SetVoiceMode(eSpeechVoiceAndText);
    Text_Slider1.Visible = true;
    Speech_Button1.Text = " ";
    Speech_Button1.NormalGraphic = 19;
    Speech_Button1.MouseOverGraphic = 19;
  }
}

But I have to click it twice to disable it the first time I start the game. I'm not really sure why. Also the text doesn't turn off when it's disabled, do you need a speech.vox for that to work?

If you don't have a speech.vox, then the voice mode should always be set to eSpeechTextOnly. I'm not sure off the top of my head if AGS actually enforces that, or expects you to. Regarding having to click twice "to disable it", what does that even mean? If the button text is initially set in the editor as " " then it should be setting eSpeechVoiceOnly the first time it's clicked, otherwise it should be setting eSpeechVoiceAndText the first time, and toggling from there between the two. At what point is it "disabled"? Oh, and there's no reason to set a MouseOverGraphic for GUI Buttons unless you're actually using a different graphic. If it's set to 0 then it's ignored (as is PushedGraphic if set to 0).

Quote from: Armageddon on Wed 30/05/2012 00:09:043. How do I change the mouse cursor when the menu is open?

In rep_exec you can do:

Code: ags
  if (gMenu.Visible) mouse.UseModeGraphic(eModePointer);
  else mouse.UseDefaultGraphic();


Where gMenu is the script name of your menu GUI.

Armageddon

Okay, that all worked really well except for the last thing. Basically when the menu isn't open it's repeatedly setting the cursor back to the original, but I have a mouse over hotspot cursor, so when I hover over a hotspot it flickers between the two. Also it doesn't change the cursor when the menu is open.

SMF spam blocked by CleanTalk