Word Balloon coding (Does this seem right)

Started by Furwerkstudio, Wed 09/12/2015 17:50:35

Previous topic - Next topic

Furwerkstudio

Hello. I am working on a game with word balloons instead of the usual speech system.

I am using one object with different views/frames, because some characters have different ways of speech and it is reflected in their balloons. Below is the code I set up, which is to change each time the player clicks on the balloon.

If anyone has a cleaner or better way of doing this please let me know.

Just to note X is a stand in for "Object", and Y is for character.

Code: ages

{
If ( X.View == 1){
	X.SetView (1, 2, 1,);
	}
	If Else (X.View == 1, 2, 1);
	X.SetView (1, 3, 1);
	Else cY.Changeroom ( 2, 20, 20);

Creamy

#1
Asraroth has made a module called Phylactere for this purpose.
I don't think it can display different balloons for each character but you may want to use it in addition to your own system.

Simply replace 'Say' by 'Phylactere' once you have imported the module.
It has been used in Freak Chic
 

Slasher

#2
It is a great module but would be better if the balloon reflected each character differently.

I have however, decided to use it in Double O : Licensed for trouble...

Baron

I wouldn't use an object, since characters can change rooms and objects can't....

I wrote my own speech bubble code for Blue Lobe Inc.  I assume you mean the bubbles would have different colours/fonts for each character?  That would be easy enough to script in, provided you made/acquired the necessary fonts and message corner graphics.  I can share my code if it's something you're interested in, but I would suggest going with the module if you're just after something you can plug and play.

Khris

The code should probably look something like this:
Code: ags

function ...() {
  if (X.Loop == 1){
    X.SetView(X.View, 2, 0);
  }
  else if (X.Loop == 2) {
    X.SetView(X.View, 3, 0);
  }
  else cY.Changeroom( 2, 20, 20);
}

Monsieur OUXX

#5
My piece of advice:
- If you're an OK scripter, download the Phylactere module and see if it's difficult to change the one type of speech bubble to several speech bubbles. If the module is properly made, it would just be a matter of replacing a small set of global variables (e.g. the pointer to the Gui used to display the speech bublle) with an array of these variables, and then choosing which one you want for each character. Then you could re-upload this enhanced version of the module, for the benefit of the whole community ;)
OR
- If you're sticking with your solution, then as Baron said, Object is a dangerous way to go since you need to create objects for each room. Guis would be better in my opinion (just use their "z" parameter to make sure they stay behind your more important guis like "game menu" and such)
- I can't remember exactly in which cases but sometimes when you change view you must not forget to call "Animate". Check the manual.

On a different note:
Khris' suggestion is good, because it removes the need for you to check the current view of the object. No matter what's the current view, his code switches to the next loop within that view. It removes the need for you to do an "If" for each view. Also he fixes a small syntax mistake for you regarding that weird "If Else" of yours.
 

SMF spam blocked by CleanTalk