I'm working on a new interface for my MAGS game, but I'm coming up with a bit of trouble.
I'm trying for a Discworld style interface, where you can pick up and put down inventory items in your inventory. I can get it to work partway, that is, I can make the item be put down when you're hovering over the space of the inventory item you're carrying. I can't make it return the inventory item when it's over a null area, though. Here's the code I'm using:
Code: AGS
And on an unrelated note, how would I be able to get a wavy effect on the background image (and some of the objects) with any alacrity, ala the line offset of the Genesis? You can see it in the Down the Tubes level of Earthworm Jim, or, I think, when you're underwater in Sonic 3. I'm not sure how I would make a sine wave distortion with the image. I tried modifying the Underwater module, but it just doesn't give the right effect. Would I need to chop the image up into lines (using the crop functions) and draw them onto a new frame at varying offsets but the same Y coords? Is that slow?
I'm trying for a Discworld style interface, where you can pick up and put down inventory items in your inventory. I can get it to work partway, that is, I can make the item be put down when you're hovering over the space of the inventory item you're carrying. I can't make it return the inventory item when it's over a null area, though. Here's the code I'm using:
// In my on_mouse_click function.
else if (button == eMouseLeftInv)
{
if (GUIControl.GetAtScreenXY (mouse.x, mouse.y) == invInventory)
{
InventoryItem* item = InventoryItem.GetAtScreenXY (mouse.x, mouse.y);
if (player.ActiveInventory != null)
{
player.ActiveInventory.Graphic = gItem.BackgroundGraphic;
if (item == player.ActiveInventory || item == null) //If the item you're over is the (now empty) active inventory, or nothing at all
{
ReturnInventory (); //Return the inventory item to it's place in the window.
}
}
else //Grab a new inventory item.
{
player.ActiveInventory = item;
gItem.BackgroundGraphic = item.CursorGraphic;
item.Graphic = 32;
if (mouse.x - 16 > 0 ) gItem.X = mouse.x - 16;
if (mouse.y - 10 > 0 ) gItem.Y = mouse.y - 10;
gItem.Visible = true;
itemvisible = true;
}
}
}
And on an unrelated note, how would I be able to get a wavy effect on the background image (and some of the objects) with any alacrity, ala the line offset of the Genesis? You can see it in the Down the Tubes level of Earthworm Jim, or, I think, when you're underwater in Sonic 3. I'm not sure how I would make a sine wave distortion with the image. I tried modifying the Underwater module, but it just doesn't give the right effect. Would I need to chop the image up into lines (using the crop functions) and draw them onto a new frame at varying offsets but the same Y coords? Is that slow?