i'm making a game with a verb coin interface.
in a room where the character is invisible(a close up room)
I would like to make the courser change into a arrow courser in the rooms corners, and if you click on the area where the arrow courser is visible , a click on that area makes the player character change room.
This is fairly simple, and there's various ways you can do this.
Create hotspots in each of the four corners, and make sure you create an "any click" event for each of the hotspots. You'll also need to create a "repeatedly execute" event for the room itself. Then, in the room script, something like this:
// room script
function room_RepExec()
{
Hotspot *hat = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
if ((hat != null) && (hat.ID >= 1) && (hat.ID <= 4)) mouse.UseModeGraphic(eModeArrow); // change these IDs to match your hotspot IDs
else mouse.UseDefaultGraphic();
}
function hHotspot1_AnyClick()
{
// change room, based on which corner this hotspot indicates
}
function hHotspot2_AnyClick()
{
// change room...
}
function hHotspot3_AnyClick()
{
// change room...
}
function hHotspot4_AnyClick()
{
// change room...
}
monkey beat me but my post is written so I'll go ahead and post it anyway:
Add the room's repeatedly_execute event, then in the room script, delete the room_RepExec function and replace it with this:
int old_sprite = -1;
bool mouse_in_corner;
#define triangle_size 30 // the corner triangle's points are 30 pixels away from the screen corner
function room_RepExec() {
int x = mouse.x, y = mouse.y;
int w = System.ViewportWidth, h = System.ViewportHeight;
if (x > w/2) x -= w;
if (y > h/2) y -= h;
int xa = x; if (x < 0) xa = -x;
int ya = y; if (y < 0) ya = -y;
if (xa + ya > triangle_size) {
if (old_sprite > -1) mouse.ChangeModeGraphic(mouse.Mode), old_sprite);
mouse_in_corner = false;
return;
}
if (old_sprite == -1) old_sprite = mouse.GetModeGraphic(mouse.Mode);
mouse_in_corner = true;
int ms;
if (x >= 0) {
if (y >= 0) ms = TOP_LEFT_ARROW_SPRITE;
else ms = BOTTOM_LEFT_ARROW_SPRITE;
}
else {
if (y >= 0) ms = TOP_RIGHT_ARROW_SPRITE;
else ms = BOTTOM_RIGHT_ARROW_SPRITE;
}
mouse.ChangeModeGraphic(mouse.Mode, ms);
}
function on_mouse_click(MouseButton button) {
if (button != eMouseLeft || !mouse_in_corner) return;
// left click in corner
ClaimEvent();
player.ChangeRoom(OTHER_ROOM);
}
This code doesn't use hotspots, but you have to enter the sprite slots of the arrows and the room number, replacing the ALL_CAPS_NAMES.