Ok, well, I've been making a game(LONE CASE) and I was wondering what control method should I be using. I tried CMI style but I didn't like it. So after playing runaway 2 I decided to make my game this style.(Not graphics , just GUI's)
Ok Well runaway 2 features the following:
1) There is a GUI label(@overhotspot@) which changes to look at hotspot or take ecc.
So i didn't bother making this since it's quite easy and besides I'm not looking for it in my game
2)When over a hotspot the player by right clicking can either look at it or interact with it.Over a character you can look at it or talk to.
3)The inventory opens through a y-pos GUI.
I didn't bother scripting this as well, since I choose to open the GUI using Middle Button.
The code is:
//mouse click//
if (button==LEFT) {
ProcessClick(mouse.x,mouse.y, mouse.Mode);
}
if (button==RIGHT) {
SelectNextMode();
player.ActiveInventory == null
}
//repeatedly execute//
if (GetLocationType(mouse.x,mouse.y) == eLocationHotspot) {
mouse.EnableMode(emodeWalkto);
mouse.EnableMode(emodeLookat);
mouse.EnableMode(emodeInteract);
mouse.DisableMode(emodeTalkto);
}
if (GetLocationType(mouse.x,mouse.y) == eLocationObject) {
mouse.EnableMode(emodeWalkto);
mouse.EnableMode(emodeLookat);
mouse.EnableMode(emodeInteract);
mouse.DisableMode(emodeTalkto);
}
if (GetLocationType(mouse.x,mouse.y) == eLocationCharacter) {
mouse.EnableMode(emodeWalkto);
mouse.EnableMode(emodeTalkto);
mouse.EnableMode(emodeLookat);
mouse.DisableMode(emodeInteract);
}
if (GetLocationType(mouse.x,mouse.y) == eLocationNothing) {
mouse.EnableMode(emodeWalkto);
mouse.DisableMode(emodeTalkto);
mouse.DisableMode(emodeInteract);
mouse.DisableMode(emodeLookat);
}
That's it as simple. If you want questions about setting up the inventory gui ask.
There are a few small errors in the code. Or is it intentional that one can't look at a character?
And about the typos: you didn't retype everything here, did you? :)
Use this:
// rep_ex
int lt=GetLocationType(mouse.x, mouse.y);
if (lt==eLocationNothing) {
mouse.DisableMode(emodeLookat);
mouse.DisableMode(emodeInteract);
mouse.DisableMode(emodeTalkto);
}
else {
mouse.EnableMode(emodeLookat);
mouse.EnableMode(emodeInteract);
if (lt==eLocationCharacter) mouse.EnableMode(emodeTalkto);
else mouse.DisableMode(emodeTalkto);
}
Quote from: KhrisMUC on Sun 08/07/2007 20:24:14
if (lt==eLocationCharacter) mouse.EisableMode(emodeTalkto);
I'm sure the above is supposed to be:
if (lt==eLocationCharacter) mouse.EnableMode(emodeTalkto);
s/Eisable/Enable/
And I suppose emodeWalkto can be omitted here as your version doesn't include it? (never even looked at AGS code before, so feel free to laugh at my ignorance ::))
Of course, thanks for pointing that out.
I left out eModeWalkTo because it is never disabled / there's no reason to disable it.
So it isn't necessary to enable it. (Unless there are other parts of the game/script that do disable it.)