Converting WalkerBoysStudio aniSprite.js and playerControl.js to C#

I’m attempting the tutorial found at Project 2D Mario – Walker Boys Studio

This is actually of the best kind of tutorial for me as I am forced to engage my mind converting from a previous unity version and converting from JS to C#. These keep me engaged a lot more.

The compiler is not finding the aniSprite class and since I’m not as familiar with JS in the context of Unity, I’m having a difficult time understanding why this is occurring:


function Update ()

    var aniPlay = GetComponent ("aniSprite");


—covert to playerControlCS.CS–

using UnityEngine;

using System.Collections;

public class playerControlsCS : MonoBehaviour


void Update () {

 		aniSprite aniPlay = GetComponent < aniSprite > ();




Compiler error: The type or namespace ‘aniSprite’ could not be found.

function aniSprite (columnSize, rowSize, colFrameStart, rowFrameStart, totalFrames, framesPerSecond)
var index : int = Time.time * framesPerSecond;
index = index % totalFrames;

var size = Vector2 ( 1.0 / columnSize, 1.0 / rowSize);											
var u = index % columnSize;																		
var v = index / columnSize;																		

var offset = Vector2 ((u + colFrameStart) * size.x,(1.0 - size.y) - (v + rowFrameStart) * size.y); 

GetComponent(Renderer).material.mainTextureOffset = offset;													
GetComponent(Renderer).material.mainTextureScale  = size;													


Hi Thanks, fo your information, I’m also trying to convert it to C# now … Recently I faced a new problem about fireball shooting script… do you have any ideas about it? please share it !!! Thanks !!