public ImpactEffect(Transform transform, SpriteSheet effectSheet, float effectLength) { m_impactSprite = new Sprite(Globals.TheGame, effectSheet, transform); m_impactSprite.Origin = new Microsoft.Xna.Framework.Vector2(0.1f, 0.9f); m_impactSprite.Alpha = 0.3f; m_spriteAnimation = new SpriteSheetAnimation(m_impactSprite, 0, effectSheet.AmountOfFrames - 1, effectLength, 1); m_spriteAnimation.Start(); }
public Title() : base() { m_sprite = new Sprite(Program.TheGame, TextureLibrary.GetSpriteSheet("titre_anime", 4, 1), m_transform); m_animation = new SpriteSheetAnimation(m_sprite, 0, 3, 1.0f, -1); m_animation.Start(); m_physics = new PhysicsComponent(Program.TheGame, m_transform); m_physics.GroundLevel = (int)TitleY; m_physics.Mass = 4; m_moveTo = new MoveToStaticAction(Program.TheGame, m_transform, new Vector2(TitleX, -100), 1); m_moveTo.Interpolator = new PSmoothstepInterpolation(); m_moveTo.Timer.Interval = 0.4f; m_transform.Position = new Vector2(TitleX, -100); }
public override void Update() { if (TouchInput.IsScreenTapped) { m_attackPosition = Vector2.Transform(TouchInput.TouchPosition, Matrix.Invert(World.cam_Main.CameraMatrix)); m_transform.Position = m_attackPosition; DestructibleComponent.DestructibleColliders[(int)AttackType.Shuriken].DoCollision(m_pointCollider, null); m_animation.Start(); float halfScreenWidth = Globals.TheGame.ScreenWidth * 0.5f; //float screenHeight = Globals.TheGame.ScreenHeight; float ratio = (TouchInput.TouchPosition.X - halfScreenWidth) / halfScreenWidth; m_transform.Direction = -1 * ratio + (float)(Globals.Random.NextDouble() - 0.5f) * 0.5f; m_transform.PosY += Globals.Random.Next(-10, 10); } m_animation.Update(); }
public Coin(COIN_TYPE type) : base() { _type = type; m_sprite = new Sprite(Globals.TheGame, CoinTextures[(int)type], Transform); m_sprite.Origin = new Vector2(0.5f, 1.0f); m_physics = new PhysicsComponent(Globals.TheGame, Transform); m_animation = new SpriteSheetAnimation(m_sprite, 0, 5, 0.1f, -1); m_animation.Start(); m_physics.Throw((float)Globals.Random.NextDouble() * 25, Globals.Random.Next(-30, -10), 0); m_physics.Mass = 1.3f; m_physics.Restitution = 0.75f; //m_physics.GroundLevel = Globals.Random.Next(-8, 3); m_physics.GroundLevel = 0; m_circleCollider = new CircleCollider(this); World.UL_Global.Add(this, 0); World.DL_ItemDrops.Add(this, 1); //ADDTHISLATER //Backpacker.HitPlayerColliders.Add(m_circleCollider, PickUp); }