PDA

View Full Version : Able to Choose between Avatars(Sprites)


Tivoilos
06-21-2008, 03:39 PM
I am working on a small ORPG in Flash using AS2(Isometric)

But I am having some trouble with allowing people to pick the avatar(sprite they want) with customization like so

1:Skin Color
2:Hair Type
3:Hair Color
4:Male
5:Female
6:Name(a-z no special characters 16char name only)

Any help would be apprechiated

rrh
06-24-2008, 04:53 PM
I would have an easier time doing this with AS3.

In this case, I'd create arrays of MovieClips, each array representing a walk cycle. (Left, Right, Up, Down) Then cycle through them by turning their _visible on and off. They could be an array of bitmaps, and then copy one at a time to the display. At the start, whatever bitmaps or images you use will need to be assembled out of pieces, given the parameters selected.

GMaker0507
06-25-2008, 01:23 PM
You could Create a master mc for each part then in that mc->

Contain on each frame a sub master mc for that certain style, and on each of those sub master mc's ->

Contain a frame for each color.

Then you could label each frame after its color/style

So it would be like this

-----------------------------------Hair_Master_Mc ->
--------------------Spikes_Master_Mc -> // On a frame named 'Spikes'
----------Yellow
----------Black
----------Brown
----------Red
--------------------PonyTail_Master_Mc -> // On a frame named 'Ponytail'
----------Yellow
----------Black
----------Brown
----------Red
--------------------Afro_Master_Mc -> // On a frame named 'Afro'
----------Yellow
----------Black
----------Brown
----------Red

Then on whatever clip the Hair_Master_Mc is on (Its Parent) you could create the variables

var Styles:Array=["Spikes","Pony Tail","Afro"]
var Colors:Array=["Yellow","Black","Brown","Red"]

var Hair_Style_Index:Number=0
var Hair_Color_Index:Number=0

Then on the first frame of Hair_Master_Mc you could have the code:


this.onEnterFrame=function(){
var HairStyle:String= _parent.Styles[_parent.Hair_Style_Index]
this.gotoAndStop(HairStyle)
}


Then on the first frame of whatever master mc was on that frame you could have the code:


this.onEnterFrame=function(){
var HairColor:String= _parent._parent.Colors[_parent.Hair_Color_Index]
this.gotoAndStop(HairColor)
}


If you did it like that, when changing them all you would have to is

(Assuming the Hair_Master_Mc was on the root stage)


_root.ChangeColorButton.onRelease=function()
{
Hair_Color_Index++
if(Hair_Color_Index>=Colors.length)
{
Hair_Color_Index=0
}
}

_root.ChangeStyleButton.onRelease=function()
{
_Hair_Style_Index++
if(Hair_Style_Index>=Styles.length)
{
Hair_Style_Index=0
}
}

Tivoilos
06-25-2008, 03:59 PM
Thanks finially someone that makes sense :P