Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Steel Drummer on Thu 11/05/2006 22:47:26

Title: Beneath a Steel Sky/Broken Sword interface
Post by: Steel Drummer on Thu 11/05/2006 22:47:26
How do I make an interface like Beneath a Steel Sky (eg: mouse changes to a cross when you move over a hotspot, inventory appears at bottom or top of screen when you move the mouse over it)
Title: Re: Beneath a Steel Sky/Broken Sword interface
Post by: Candle on Thu 11/05/2006 23:08:57
Sorry posted the wrong thing again. lol
I use :
//mouseover forward
SaveCursorForLocationChange();
SetMouseCursor(11);

///mouseover return
SaveCursorForLocationChange();
SetMouseCursor(13);

//mouseleft
SaveCursorForLocationChange();
SetMouseCursor(12);

//mouseright
SaveCursorForLocationChange();
SetMouseCursor(10);
These are for my arrows.
Title: Re: Beneath a Steel Sky/Broken Sword interface
Post by: Scummbuddy on Thu 11/05/2006 23:11:02
ChangeModeGraphic
(Formerly known as ChangeCursorGraphic, which is now obsolete)

Mouse.ChangeModeGraphic(CursorMode, int slot)

Changes the specified mouse cursor mode's cursor graphic to SLOT. This permenantly changes the specified mode's cursor graphic. This function may be useful if you need more than the maximum number of mouse cursors.
Example:

mouse.ChangeModeGraphic(eModeLook, 120);

will change the cursor's graphic for look mode to the image that's imported in the sprite's manager slot 120.
See Also: Mouse.ChangeModeHotspot, Mouse.ChangeModeView, Mouse.Mode
Title: Re: Beneath a Steel Sky/Broken Sword interface
Post by: Khris on Thu 11/05/2006 23:25:12
I was in the mood :P

function repeatedly_execute() {
Ã, int x=mouse.x;
Ã, int y=mouse.y;
Ã, Hotspot*hot=Hotspot.GetAtScreenXY(x, y);
Ã, Object*obj=Object.GetAtScreenXY(x, y);
Ã, Character*cha=Character.GetAtScreenXY(x, y);

Ã, int mmode=eModeWalkTo; Ã,  // standard cursor i.e. mouse isn't over anything
Ã, if (hot!=null || obj!=null || cha!=null) mmode=eModeInteract; Ã,  // crosshair cursor
Ã, Mouse.Mode=mmode;

Ã, // Inventory GUI at bottom of the screen
Ã, if (y>310 && gInv.Visible==false) gInv.Visible=true;
Ã, if (y<290 && gInv.Visible==true) gInv.Visible=false; Ã, // 210 if the GUI is 30 px high and screen is 240px high
}

function on_mouse_click(MouseButton button) {
Ã, if (IsGamePaused() == 1) {
Ã,  Ã, // Game is paused, so do nothing (ie. don't allow mouse click)
Ã, }
Ã, else if (button == eMouseLeft) {
Ã,  Ã, ProcessClick(mouse.x, mouse.y, eModeInteract);
Ã, }
Ã, else if (button == eMouseRight) {
Ã,  Ã, ProcessClick(mouse.x, mouse.y, eModeLook);
Ã, }
}


For the inventory, use a custom GUI with an inventory window as big as the GUI (except maybe arrows to the left and right), name the window e.g. "invwindow" and call invwindow.CharacterToUse = player; in game_start().

This should work/be complete, if not, I'm tired ;)
Title: Re: Beneath a Steel Sky/Broken Sword interface
Post by: SSH on Fri 12/05/2006 10:38:31
You can use system.viewport_height and gInv.Height to make that code more generic, KhrisMUC...

/me feels a module comign on