c# - XNA game Development, update sprite -


would tell did wrong in code...i trying move sprite whenever left arrow on keyboard pressed. when run code game window open , shut off prtty quickly

public class sprite {     private texture2d texture;     private vector2 position;      public sprite(texture2d texture, vector2 position)     {         // todo: complete member initialization         this.texture = texture;         this.position = position;     }      public void draw(spritebatch spritebatch)     {         spritebatch.draw(texture, position, color.white);     }      void update(keyboardstate keyboardstate, gametime gametime)     {         // throw new notimplementedexception();         if (keyboardstate.iskeydown(keys.left))         {             velocity = new vector2(-1, 0);             position+= ((velocity) *(float) gametime.elapsedgametime.totalseconds);         }     }     public vector2 velocity { get; set; }  } 


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -