- Home /
Question by
Penfwasaurus · Feb 28, 2014 at 07:53 PM ·
c#2dsprite
Sprite Swapping help
Ive just started to create my first 2d game, im decent at 3d games, but I want to know how to change my sprite after I press a button, eg. "D" or "A"
Ive got this far :
public Sprite right;
public Sprite left;
void Update(){
if(Input.GetKey("D")){
Getcomponent(SpriteRenderer)//Then I want to call on it to select the Sprite "Right"
if(Input.GetKey("A")){
Getcomponent(SpriteRenderer)//Then I want to call on it to select the Sprite "Left"
}
}
But Then how do i call upon the sprite itself to be changed depending on whether i choose right or left? help?:/
Comment
Your answer
Follow this Question
Related Questions
Sprite image not changing 0 Answers
Way to have 2D Sprites lit by Lights? 3 Answers
Strange artifacts in builds 0 Answers
Start sprite animation at the same index that the previous animation stopped 2 Answers