Idea -> how to change body parts. (How do you make it).

Post and discuss creative ideas

Idea -> how to change body parts. (How do you make it).

Postby OwnerOfSuccuby » Wed Mar 02, 2016 6:01 pm

For now i only see that way of changeing body parts:
1)GoToAndPlay() - wjen it enters frame it changes on some value
2)GotoAndStop() - the same / And to change again reload the model to another frame and back
3)Make it derectly from main layer HeyYouPartNumber1.PartInPart1.PartInPartInpart1(GotoAndStop(1));

Or may be there are another ways - that i do not know ?

I get interesting idea about it :twisted: :mrgreen: (Using recurtion and auto understanding of what to load).

Can you tell me what other ways are i try to understand what is the best way :mrgreen:
OwnerOfSuccuby
 
Joined: Fri Jun 11, 2010 9:33 pm

Re: Idea -> how to change body parts. (How do you make it).

Postby dullman » Fri Mar 04, 2016 3:17 pm

Whilst i has not much experience for flash, but when i tried to make a game in it i use the similar approach as in other game engines (although my avatar wasn't really animated, so with animation it's more complicated but i believe even flash shouldn't make it impossible), so store character movieClip in some variable (i was using a dedicated class to draw/create/redraw/etc. avatar) and rebuilding it on demand (so basically only when other function call the create avatar function), since this allow to keep only one instance of equipment as template even if it used by many characters, the additional amount are created when they equip ti and destroyed when unequip, of course we should understand that if we destroy equipment mc we should keep information in item instance which allow us to recreate it from template, if we want to play animation on that avatar we just need to create animation on template, and then just create a copy of animation and swap all shapes in animation for the ones needed by us (basically our character(s)) it's easy task if the body parts/equipment just differs from template in coloring/art but the size remains the same, we can simply just copy transform information from one shape to another, the situation it's more complicated if we have different body parts (like thin and thick leg) then the size will remain different, but the easiest way to work around that that is not programming based is just this two shapes are drawn on the movie clips which both had the same size (although from what i remember the flash create MC as small as possible, but for smaller one we can just put invisible points into two corners), it's only works if the size are different on only one axis, for more i do not know non programming tricks.
dullman
 
Joined: Fri Aug 15, 2014 6:15 pm

Re: Idea -> how to change body parts. (How do you make it).

Postby GoRepeat » Sat Mar 05, 2016 4:48 am

Lately I have been playing with a dynamic push to all the children from a stage object. So you would have your container that calls the animations, then when the animation loads, it cycles through the children to see if they are valid movieclips/not null and then passes them the variable. That way you can avoid 50 lines of "asset_1.gotoandStop, asset_2.gotoandstop" etc etc and constantly run into null errors because certain characters have certain assets (armor, for example) that other don't:

Code: Select All Code
function loadAssets():void{
   var objects:int = anim.numChildren;
   for(var i:int=0; i<objects; i++){
      if(String(getQualifiedClassName(anim.getChildAt(i)))=="flash.display::MovieClip"){
         var targetObject:MovieClip = MovieClip(anim.getChildAt(i));
         if(targetObject!=null){targetObject.gotoAndStop(armorState)}
      }
   }
}


(refresh/reset the animation to randomize the assets):
Click to Play
(Javascript Required)

Untitled-2.swf [ 269.76 KiB | Viewed 551 times ]



Basically, use numChildren to count the assets, then set up a for() loop from 0 to numChildren to cycle through them and push the code down using getChildAt.
Picarto LiveStream: https://picarto.tv/GoRepeat
Other Stuff: Click Here
User avatar
GoRepeat
Moderator
 
Joined: Wed Jul 21, 2010 2:26 am
Location: Behind the Looking Glass


Return to Discussion



Who is online

Users browsing this forum: No registered users