git-svn-id: https://bd85.net/svn/cs3505_group@163 92bb83a3-7c8f-8a45-bc97-515c4e399668
[chaz/carfire] / CarFire / CarFire / CarFire / AnimateMelee.cs
1 ´╗┐using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using Microsoft.Xna.Framework;
6 using Microsoft.Xna.Framework.Graphics;
7 using Microsoft.Xna.Framework.Content;
8
9 namespace CarFire
10 {
11 class AnimateMelee
12 {
13
14 //member variables
15 private AnimatedTexture SpriteTexture;
16 string[] fileNames = new string[] { "graphics/meleeAttack", "graphics/meleeDying",
17 "graphics/meleeExplosion", "graphics/meleeStanding", "graphics/meleeWalking" };
18 private ContentManager contentManager;
19 //private GraphicsDeviceManager graphics;
20 //private SpriteBatch spriteBatch;
21
22 private string ph;
23 private Vector2 position;
24 private SpriteBatch character;
25
26 //constructor(s)
27 public AnimateMelee(ContentManager content)
28 {
29 SpriteTexture = new AnimatedTexture(Vector2.Zero, 0, 1.0f, 0.5f);
30 contentManager = content;
31 ph = fileNames[3];
32 position = Vector2.Zero;
33 }
34
35 //methods
36
37 public void AttackLeft(SpriteBatch spriteBatch)
38 {
39 ph = fileNames[0];
40 //graphics = graphicsDeviceManager;
41 //this.spriteBatch = spriteBatch;
42 //spriteBatch.
43
44 character = new SpriteBatch(spriteBatch.GraphicsDevice);
45 Animate();
46
47
48 // SpriteTexture.Load(graphics.GraphicsDevice, contentManager, "fileNames[0]", 8, 12, true, 1);
49 }
50
51 public void Animate()
52 {
53 //character = new SpriteBatch(graphics.GraphicsDevice);
54 // "character" is the name of the sprite asset in the project.
55 Console.WriteLine(ph);
56 SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, true, 1);
57 //viewport = graphics.GraphicsDevice.Viewport;
58 position = new Vector2(0, 0);//viewport.Width / 2, 0);//viewport.Height / 2f);
59
60 character.Begin();
61 SpriteTexture.DrawFrame(character, position);
62 character.End();
63 }
64
65 }
66 }
This page took 0.042196 seconds and 4 git commands to generate.