i moved the code for animation switching in onKeyDown and onKeyUp, but switch between the animations two times and then it doesnt whant to change
On 11 Май, 20:16, toshmosh <[email protected]> wrote: > http://tues-forum.com/ee/materials/last.zip > Here is a link with the whole source code and assets > > On 11 Май, 19:03, Vesselin Russinov <[email protected]> wrote: > > > > > i want to thank you for the quick reply :) > > the funnies thing in this project is that we use the same methods as > > shown in the examples with the same animation and it doesn't work :D > > > On May 11, 5:47 pm, Michael Iv <[email protected]> wrote: > > > > No , from Israel > > > > On Tue, May 11, 2010 at 5:45 PM, toshmosh <[email protected]> wrote: > > > > ok i will try it when i am at home.By the way are from Bulgaria? > > > > > On May 11, 5:42 pm, Michael Iv <[email protected]> wrote: > > > > > You don't need to stop , just in another key press play another > > > > > animation > > > > It > > > > > should switch to that . Just like in svn trunk example > > > > > > On Tue, May 11, 2010 at 5:24 PM, toshmosh <[email protected]> > > > > wrote: > > > > > > so you suggest to start the animation in onKeyDown? > > > > > > i tryied it, but i couldnt stop it in onKeyUp when use > > > > > > model.AnimationLibrary.getAnimation("run").animator.stop().It stops > > > > > > but it cannot play more animations. > > > > > > > On May 11, 4:33 pm, Michael Iv <[email protected]> wrote: > > > > > > > I think the problem may be that you play the animation anew each > > > > frame > > > > > > while > > > > > > > the specific key is down . Look at your code , when for example > > > > > > > the > > > > back > > > > > > key > > > > > > > is down you tell the animator to start play on each frame , you > > > > repeat > > > > > > the > > > > > > > command over and over . > > > > > > > > On Tue, May 11, 2010 at 4:26 PM, toshmosh <[email protected]> > > > > > > wrote: > > > > > > > > I am using the ogre model in the examples. > > > > > > > > > On May 11, 3:14 pm, Michael Iv <[email protected]> wrote: > > > > > > > > > can you tell me what program do you use for naming animation > > > > > > sequences > > > > > > > > for > > > > > > > > > MD2 ? > > > > > > > > > > On Tue, May 11, 2010 at 9:52 AM, toshmosh < > > > > [email protected]> > > > > > > > > wrote: > > > > > > > > > > Hi!Whit my friend have started to develop 3d game with > > > > > > > > > > away3d > > > > for > > > > > > > > > > school topic and we cannot deal with the animations.I am > > > > loading > > > > > > two > > > > > > > > > > md2 models- the ogre from the lessons, then in onKeyDown it > > > > > > > > > > is > > > > > > > > > > registered where to move in boolean variables , in onKeyUp > > > > > > > > > > is > > > > > > > > > > deregistered, and in onEnterFrame this variables are > > > > > > > > > > checked > > > > in if > > > > > > > > > > forward is true it plays the run animation else play the > > > > stand.The > > > > > > > > > > game plays the run animation once and then cannot change to > > > > > > stand.Any > > > > > > > > > > suggestions? onkeyDown and onKeyUp are down, just > > > > > > > > > > scroll.Also > > > > there > > > > > > > > > > are two extern files for Terrain and Resources,but they are > > > > > > > > > > not > > > > > > > > > > related: > > > > > > > > > > > package > > > > > > > > > > { > > > > > > > > > > import away3d.animators.data.*; > > > > > > > > > > import away3d.cameras.*; > > > > > > > > > > import away3d.containers.*; > > > > > > > > > > import away3d.core.base.*; > > > > > > > > > > import away3d.core.clip.*; > > > > > > > > > > import away3d.core.filter.*; > > > > > > > > > > import away3d.core.math.*; > > > > > > > > > > import away3d.core.render.*; > > > > > > > > > > import away3d.core.utils.*; > > > > > > > > > > import away3d.events.*; > > > > > > > > > > import away3d.lights.*; > > > > > > > > > > import away3d.loaders.*; > > > > > > > > > > import away3d.materials.*; > > > > > > > > > > import away3d.materials.utils.*; > > > > > > > > > > import away3d.primitives.*; > > > > > > > > > > > import flash.display.*; > > > > > > > > > > import flash.events.*; > > > > > > > > > > import flash.filters.*; > > > > > > > > > > import flash.ui.Keyboard; > > > > > > > > > > > import wumedia.vector.VectorText; > > > > > > > > > > [SWF(backgroundColor="#000000", frameRate="30", > > > > > > quality="LOW", > > > > > > > > > > width="800", height="600")] > > > > > > > > > > > public class Game extends Sprite > > > > > > > > > > { > > > > > > > > > > > [Embed (source="../fonts/extrusionfonts.swf", > > > > > > > > > > mimeType="application/ > > > > > > > > > > octet-stream")] > > > > > > > > > > public static const Fonts:Class; > > > > > > > > > > private var textfield:TextField3D; > > > > > > > > > > > //engine variables > > > > > > > > > > public var scene:Scene3D; > > > > > > > > > > public var camera:SpringCam; > > > > > > > > > > public var view:View3D; > > > > > > > > > > public var skybox:Skybox6; > > > > > > > > > > public var frustum_clipping:FrustumClipping; > > > > > > > > > > public var > > > > > > > > > > nearfield_clipping:NearfieldClipping; > > > > > > > > > > > //scene objects > > > > > > > > > > private var md2:Md2; > > > > > > > > > > private var md22:Md2; > > > > > > > > > > private var model:Mesh; > > > > > > > > > > private var model2:Mesh; > > > > > > > > > > private var isModelMoving:Boolean; > > > > > > > > > > > //movement > > > > > > > > > > private var moving:Boolean = false; > > > > > > > > > > private var forward:Boolean = false; > > > > > > > > > > private var backward:Boolean = false; > > > > > > > > > > private var turnLeft:Boolean = false; > > > > > > > > > > private var turnRight:Boolean = false; > > > > > > > > > > private var stillMoving:Boolean = false; > > > > > > > > > > private var jump:Boolean = false; > > > > > > > > > > private var count:int = 0; > > > > > > > > > > > public var res:Resources; > > > > > > > > > > public var terrain:Terrain; > > > > > > > > > > > //lights > > > > > > > > > > public var simpleShadow:SimpleShadow; > > > > > > > > > > > public var sunLight:DirectionalLight3D; > > > > > > > > > > > public function Game() > > > > > > > > > > { > > > > > > > > > > > > > > > > > > > > addEventListener(Event.ADDED_TO_STAGE, > > > > > > init); > > > > > > > > > > } > > > > > > > > > > > private function init(evt:Event):void > > > > > > > > > > { > > > > > > > > > > res = new Resources(); > > > > > > > > > > initEngine(); > > > > > > > > > > terrain = new Terrain(); > > > > > > > > > > initObjects(); > > > > > > > > > > initListeners(); > > > > > > > > > > > } > > > > > > > > > > > private function initEngine():void > > > > > > > > > > { > > > > > > > > > > scene = new Scene3D(); > > > > > > > > > > > frustum_clipping = new > > > > FrustumClipping(); > > > > > > > > > > frustum_clipping.minZ = -50; > > > > > > > > > > frustum_clipping.maxZ = 400; > > > > > > > > > > > nearfield_clipping = new > > > > > > NearfieldClipping(); > > > > > > > > > > view = new View3D(); > > > > > > > > > > view.scene = scene; > > > > > > > > > > view.clipping = frustum_clipping; > > > > > > > > > > //view.camera = camera; > > > > > > > > > > > /*var fogColour:ColorMaterial = new > > > > > > > > > > ColorMaterial(0x002222); > > > > > > > > > > var renderer:BasicRenderer = > > > > (view.renderer > > > > > > as > > > > > > > > > > BasicRenderer); > > > > > > > > > > var mfilters:Array = [new > > > > > > > > > > FogFilter({minZ:100,maxZ:500,subdivisions: > > > > > > > > > > 20,material:fogColour})]; > > > > > > > > > > renderer.filters = mfilters;*/ > > > > > > > > > > > addChild(view); > > > > > > > > > > > //sunLight = new > > > > > > > > > > DirectionalLight3D(); > > > > > > > > > > //sunLight.direction = new > > > > > > > > > > Number3D(0, > > > > -1, > > > > > > 0); > > > > > > > > > > //sunLight.ambient = 20; > > > > > > > > > > //sunLight.diffuse = 40; > > > > > > > > > > //sunLight.specular = 300; > > > > > > > > > > //sunLight.brightness = 100; > > > > > > > > > > //sunLight = new PointLight3D( { x:0, > > > > y:-1, > > > > > > z: > > > > > > > > 0, > > > > > > > > > > brightness:1000, > > > > > > > > > > ambient:0.1, diffuse:0.7 } ); > > > > > > > > > > //scene.addLight(sunLight); > > > > > > > > > > > VectorText.extractFont(new > > > > > > Fonts(),null,false); > > > > > > > > > > > > > ... > > четете още»
