05220ee7c367c29254777ef3db364ce7d29f2faf
[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 Player Player;
26
27 //constructor(s)
28 public AnimateMelee(ContentManager content, Player player)
29 {
30 SpriteTexture = new AnimatedTexture(Vector2.Zero, 0, 1.0f, 0.5f);
31 contentManager = content;
32 ph = fileNames[3];
33 position = Vector2.Zero;
34 Player = player;
35
36 }
37
38 //methods
39
40 public void AttackLeft(SpriteBatch spriteBatch, Vector2 drawSpot)
41 {
42 ph = fileNames[0];
43 //graphics = graphicsDeviceManager;
44 //this.spriteBatch = spriteBatch;
45 //spriteBatch.
46 //character = new SpriteBatch(spriteBatch.GraphicsDevice);
47 character = spriteBatch;
48 Animate(drawSpot);
49
50
51 // SpriteTexture.Load(graphics.GraphicsDevice, contentManager, "fileNames[0]", 8, 12, true, 1);
52 }
53
54 public void Animate(Vector2 drawSpot)
55 {
56 //character = new SpriteBatch(graphics.GraphicsDevice);
57 // "character" is the name of the sprite asset in the project.
58 Console.WriteLine(ph);
59 SpriteTexture.Load(character.GraphicsDevice, contentManager, ph, 8, 12, true, 1);
60 //viewport = graphics.GraphicsDevice.Viewport;
61 position = new Vector2(Player.Coordinates.X*Map.PixelsToUnitSquares, Player.Coordinates.Y*Map.PixelsToUnitSquares);//viewport.Width / 2, 0);//viewport.Height / 2f);
62 Console.WriteLine(drawSpot);
63 //character.Begin();
64 SpriteTexture.DrawFrame(character, drawSpot);
65 //character.End();
66 }
67
68 }
69 }
This page took 0.041599 seconds and 3 git commands to generate.