public override void Initialize(World world) { base.Initialize(world); //Make it so we can be possesed Possesable = true; //Create the input controller inputController = new InputController(); //Attach us to the input controller bool attached = inputController.Posses(this); if (!attached) { throw new System.InvalidOperationException("Failed to attach input controller to player entity!"); } //Create the camera to represent the player PlayerCamera = EntityManager.CreateEntity <ECamera>(OwningWorld, true); CameraManager.SetActiveCamera(PlayerCamera); //Create the sprite that represents us animation = AddComponent <CSpriteAnimation>(); animation.SetupAnimation(PlayerSprite, 24, 1); animation.SetAnimationFrames(animations["idle"]); currentAnimation = "idle"; animation.SetSpeed(2); animation.Play(); transform.Scale = new Vector2(4, 4); //CreateSpherePhysics(10); PhysicsObject b = CreateSpherePhysics(32, ChipmunkSharp.cpBodyType.DYNAMIC, 10000, 1000000000); }
public override void Initialize(World world) { base.Initialize(world); //Make it so we can be possesed Possesable = true; //Create the input controller inputController = new InputController(); //Attach us to the input controller bool attached = inputController.Posses(this); if (!attached) { throw new System.InvalidOperationException("Failed to attach input controller to player entity!"); } //Create the camera to represent the player PlayerCamera = EntityManager.CreateEntity <ECamera>(OwningWorld, true); CameraManager.SetActiveCamera(PlayerCamera); //Create the sprite that represents us animation = AddComponent <CSpriteAnimation>(); animation.SetupAnimation(ControllerSprite, 24, 1); animation.SetAnimationFrames(new int[] { 1, 2, 3, 4 }); animation.SetSpeed(2); animation.Play(); transform.Scale = new Vector2(4, 4); }