Getting background image from previous room? [SOLVED, but GOAL CHANGED]

Started by Jack Hare, Sat 07/02/2009 02:39:10

Previous topic - Next topic

Jack Hare

Well, I've searched and searched, but I've finally reached a question I wasn't able to work out for myself...

I've got a room accessible from anywhere that's supposed to act as a sort of psuedo-GUI to handle inventory in a novel way, but I'd like to create the illusion that it's just a pop-up.  To that end, the inventory room's background features the inventory panel, and a blank gray space; I want to fill the gray space with the player's previous room background image (presumably using dynamic sprites / drawing functions).

But I just can't figure out how to phrase it.  How can I tell this room to call up the player.PreviousRoom in such a way as to get the BACKGROUND image from it?
This post isn't self-referential, unless you count the signature line.

monkey0506

#1
If you're wanting to use the character's previous room you could do something like this:

Code: ags
// GlobalScript.ash
import DynamicSprite *PreviousRoomBackground;


Code: ags
// GlobalScript.asc
DynamicSprite *PreviousRoomBackground;
export PreviousRoomBackground;

function on_event(EventType event, int data) {
  if (event == eEventLeaveRoom) {
    if (PreviousRoomBackground != null) {
      PreviousRoomBackground.Delete();
      PreviousRoomBackground = null;
    }
    PreviousRoomBackground = DynamicSprite.CreateFromBackground();
  }
}


Then the PreviousRoomBackground sprite would always contain a copy of the background of the room the player was most recently in.

But it does beg the question, why not just use a GUI?

In any case, you could then draw the previous background like this:

Code: ags
// presumably the room_Load function
  if (PreviousRoomBackground == null) return;
  DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
  surface.DrawImage(X, Y, PreviousRoomBackground.Graphic, WIDTH, HEIGHT);
  surface.Release();

Jack Hare

QuoteBut it does beg the question, why not just use a GUI?

That's probably the best question; I'm not totally committed to this approach by any means, and I sure wouldn't say I know what I'm doing yet in AGS.  From various threads, though, it appears as though the most common workaround for getting an inventory to behave the way I want involves creating a bunch of invisible dummy characters, which doesn't seem to be any simpler or more efficient than creating a dummy room.

In part, I'm experimenting in this direction just because it involves more commands and processes that I've already figured out how to do, but I'm certainly open to better ideas.  :D

In any event, I figured that even if I discarded this approach, learning how to do it would still give me some insight into related concepts, which it has -- seeing this in code has really cleared some very basic things up for me.  Thanks!
This post isn't self-referential, unless you count the signature line.

monkey0506

Just as a point of interest, what is "the way you want the inventory to behave"?

Jack Hare

Quote from: monkey_05_06 on Sat 07/02/2009 06:47:11
Just as a point of interest, what is "the way you want the inventory to behave"?

Aheh, your reply came in even as I was going to edit my original post.  Thanks again for asking the little question that made me stop and go, "Wait, what am I up to here?"

What I should have done in the first place is more like this:

My inventory concept is based around this board...



I know what I want it to do, and in view of my deepening realization of just how new I am at this, I'll skip trying to explain the various ideas I've had toward getting there.

You begin the game wearing overalls with five pockets, each of which can store up to four "size points" worth of item, represented by the little gold rings.  The rings light up to show how many points worth of space are currently occupied, which isn't strictly the same as the number of objects.

As the game goes on, your character changes clothes, picks up baskets or backpacks, and otherwise changes the number and nature of the storage spaces you have, calling up different icons in the bottom of the little pits.

Naturally, I want inventory objects to appear in the little pits.  Ideally, you'd also be able to move them around from pocket to pocket just for style, but it doesn't much matter in the game where you carry things as long as you've got space left.

Left-clicking on an inventory item should pop up a larger image in the large green display, and a text description in the dark green bar up top.  The gold buttons, from the left, allow you to Drop, Nibble, Combine, Break or Use the displayed object, where Use closes the interface and gives you the item as a cursor (right-clicking an object automatically Uses it, as well).  A variety of other buttons appear above that when an object has other actions available.

So that's how I want it to work, and I won't say I've got no idea how to do it, but the ideas I do have are elaborate and clunky.  The idea about creating a separate room to do it in was sort of a blue-sky sketch of a concept for approaching it without using iItems at all, or in a limited way, but my original question was spurred by frustration that I didn't even know enough to set up the experiment.

Any suggestions for more elegant ways to work this would be deeply appreciated.

Thanks!
This post isn't self-referential, unless you count the signature line.

Khris

Not really constructive, just a thought: limiting the inventory can be a pretty big turn-off for potential players.
I flat out hate having to rearrange or drop items because of a full inventory. It might add realism, but games don't need to be realistic, they need to be fun.
Just my 2 cents :)

Jack Hare

#6
Fair enough, I wouldn't have posted if I didn't want people's common cents.

I do see your point, though, and I've also been reading up here on people's likes and dislikes in games.  The way this game is emerging, I think there are elements that mitigate against the frustration factor:

To begin with, very little of the game depends on having specific objects; when you do need a specific thing, it's always made very clear in the storyline and NEVER involves objects from outside the current level.  More often, those goals that involve your inventory at all can be accomplished by multiple means -- I haven't got any screwdrivers, hammers, crowbars or crates in the game, but if there were, all three of the former would be able to open the latter.

Which relates to the second point, that most of the challenges in the game aren't inventory based at all, but depend rather on dialogue with the other characters -- that is, when you run into a locked door in this game, it's more often a matter of getting permission to go inside than it is a matter of working out how physically to open the door.

On a more pragmatic level, throughout most of the game you've got more storage space than you need -- in fact, most of the time your character Pixie has some sort of living space of her own where she can store extra things (there's a mini-map teleportation system so that going back to your room for stuff isn't too much of a hassle; I'm considering even putting Pixie's room(s) on the inventory bar as a sort of bottomless pocket).  There are a few key points where I twist the screws on what you can carry, which are mostly designed to raise the suspense during scary parts where Pixie has lost her former home and some of the comforts you've been led to take for granted have been knocked out from under you.

For the most part, the limited inventory spaces serve as a checklist rather than a prohibition -- for example, in the first chapter you get a basket with twelve spaces, and the goal of finding a dozen Easter eggs around the farm, so the empty spaces in the basket serve as a visual meter of your progress.  Most of the inventory space types, apart from the pockets on your actual garment, have similar functions, as places to keep specific classes of thing.  Your pocket space itself, with (in most outfits) twenty spaces, is in almost every chapter more than enough to hold the total number of objects available.

None of this matters, of course, if the player is just turned off by the notice on the basic Help page that says "INVENTORY SPACE IS LIMITED,  NOT ALL OBJECTS ARE IMPORTANT", but for players to whom a limited inventory isn't an immediate deal killer, I think the limited spaces will remain mostly transparent and unobtrusive through most of the game.

In any event, even if I decide to make the inventory bottomless, I still want to represent it visually using the format above.

Sorry to ramble on like this, but I do find that nailing some of these principles down in words really helps to work out parts that are still vague or broken.  Thanks for the input!
This post isn't self-referential, unless you count the signature line.

SMF spam blocked by CleanTalk