Help with in game store

Started by Sweet_Daddy_C, Mon 26/04/2010 01:25:38

Previous topic - Next topic

Sweet_Daddy_C

Hi all

Im brand new on AGS, but I do have a little experience on actionscript. What Im trying to do is to create an in game store where you can buy new clothes, accesories and other things with your points and apply to the character accordingly... Im trying to work out if there is an easier way than drawing out all the diffrent combinations of clothing and other things or is there a way of layering up the items much like a dress up game... I have tried to explain it as best I can, hopefully you will get the gist

Any help is muchly appreciated

SDC

Monsieur OUXX

Hi,

Your explanations were pretty clear.

AGS is not very good at creating dynamic graphics composed of layers that you could show or hide. Only the GUIs can do that, but you'll lose the benefit of having a Character.
If you really want to stick to a layer system, then you'll have to make your hands dirty and start reading the documentation of the DynamicSprite object, for example.

Otherwise, you can use workarounds. For example you could move simultaneously several objects* (one for the legs, one for the torso, one for the head, etc.) depending on the clothes you want your character to have on. (The difference here is that there will be no layers - instead you choose "what legs" he's going to have).

*I'll leave it to you to find what kind of objects you'll want to use (will it be Characters? etc.).
 

abstauber

Well it's also possible with merging views during runtime. But be warned, it'll include some heavy scripting.

What you can do is: export each layer into a seperate view, like underpants/character, shirt and pants.

During runtime you create a dynamic sprite. Then you take a viewframe from each view (character, shirt, pants again) at the current frame of the character. After that you draw all three viewframes on the dynamic sprite's surface and apply it to the characters viewframe.

Jim Reed

Or you can take a gun and shoot yourself, it would be easier =)

Dunno, the first Diablo used a few types of views, representing many armors/clothes and such, that might or might not be easier for you.

Monsieur OUXX

Quote from: abstauber on Mon 26/04/2010 08:28:11
Well it's also possible with merging views during runtime. But be warned, it'll include some heavy scripting.

What you can do is: export each layer into a seperate view, like underpants/character, shirt and pants.

During runtime you create a dynamic sprite. Then you take a viewframe from each view (character, shirt, pants again) at the current frame of the character. After that you draw all three viewframes on the dynamic sprite's surface and apply it to the characters viewframe.

So we agree that you'll have to generate the graphics dynamically at runtime.
I'll detail the idea even more :
- create all your graphics for your naked character, import them in AGS in a view.
- create all your graphics for a piece of garment #1, import them in AGS in a view.
- create all your graphics for a piece of garment #2, import them in AGS in a view.
Importing them in views will make it easy to manipulate them/load them/iterate through them from your AGS script.

In your script, whenever you render your character (you can let AGS do that automatically with the naked character, for example), then you must use the current state of the character to decide how you're going to draw the clothes. For example use the methods of the "Character" object to find out what frame of its walkcycle is being rendered.

Once you know that, use the DynamicSprite methods to start rendering the clothes on top of the character. Since you know what frame of the character is supposedly being drawn, you should be able to find easily the corresponding frame of the clothe's view, for each piece of clothe.

That's pretty much it.

Note that the solution above is a compromise of what I wrote in the forst place, i.e. using a native object (Character) to do some of the basic computing, and scripting yourself (with DynamicSprite) to do the fancy stuff.
 

SMF spam blocked by CleanTalk