Skip to content

Instantly share code, notes, and snippets.

@kovek
Created Feb 7, 2013
Embed
What would you like to do?
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