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

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -