Troubles with Inventory / Creating a Wavy Line Effect

Started by Scavenger, Thu 08/08/2013 21:09:55

Previous topic - Next topic

Scavenger

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

// 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?

Gilbert


Scavenger

Yeah! Exactly like those. All four in fact. I'm just not sure how to do it efficiently enough for real time.

Gilbert

It's just some random test I've tried(and severely limited atm, as as far as I remember it could only shift < 10 pixels each line or something, so it needs some for refining but it didn't happen). I'll PM to you a link of the source for your reference. As it's been a few years ago I may not be able to decipher immediately what each line does in it.

Scavenger

Yeah, I think this is just about enough for me to decipher! I can work out most of the specifics and work around the limitations of the code for now.

SMF spam blocked by CleanTalk