Skip to content

Instantly share code, notes, and snippets.

@kovek
Created February 7, 2013 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kovek/4727516 to your computer and use it in GitHub Desktop.
Save kovek/4727516 to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class Character : MonoBehaviour {
private float speed = 0.2F;
private Texture[] buffer = new Texture[2];
private Texture image;
void Start () {
image = Resources.Load("sprite_sheet") as Texture;
Debug.Log ("Is null?" + (image==null));
GUI.DrawTextureWithTexCoords(new Rect(0, 0, 100, 100), image, new Rect(0f, 0f, 0.333f, 0.333f), true);
}
void Update () {
}
public void move(KeyCode direction){
Debug.Log("received a click");
float blocks = 0.0f;
if(direction == KeyCode.RightArrow){
blocks = speed;
}
if(direction == KeyCode.LeftArrow){
blocks = -speed;
}
mover.Move(blocks, 0, this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment