Commits

PolCPP committed 46a8f74

Another refactorization: Cleaned code/folders, formatted it, reorganized it differently, the old controllers are now called managers.
Fix: If you were moving with the direction controls and tapped with another finger it stopped moving

Note on: 261602a86344fe69f62d84384c439bdf07170709 , the game is also resolution independent now, so you can change it without trouble and should work on all android devices.

Comments (0)

Files changed (43)

Assembly-CSharp-vs.csproj

      <Compile Include="Assets\RagePixel\Code\RagePixelSettings.cs" />
      <Compile Include="Assets\RagePixel\Code\RagePixelSprite.cs" />
      <Compile Include="Assets\RagePixel\Code\RagePixelSpriteSheet.cs" />
-     <Compile Include="Assets\scripts\CameraController.cs" />
-     <Compile Include="Assets\scripts\GUIController.cs" />
-     <Compile Include="Assets\scripts\InputController.cs" />
-     <Compile Include="Assets\scripts\PlayerChar.cs" />
-     <Compile Include="Assets\scripts\VirtualPad.cs" />
+     <Compile Include="Assets\Scripts\Button.cs" />
+     <Compile Include="Assets\Scripts\CameraManager.cs" />
+     <Compile Include="Assets\Scripts\GUIManager.cs" />
+     <Compile Include="Assets\Scripts\InputManager.cs" />
+     <Compile Include="Assets\Scripts\PlayerCharacter.cs" />
      <None Include="Assets\RagePixel\readme.txt" />
      <None Include="Assets\RagePixel\Code\RagePixelBasicFlash.shader" />
      <None Include="Assets\RagePixel\Code\RagePixelBasic.shader" />

Assembly-CSharp.csproj

      <Compile Include="Assets\RagePixel\Code\RagePixelSettings.cs" />
      <Compile Include="Assets\RagePixel\Code\RagePixelSprite.cs" />
      <Compile Include="Assets\RagePixel\Code\RagePixelSpriteSheet.cs" />
-     <Compile Include="Assets\scripts\CameraController.cs" />
-     <Compile Include="Assets\scripts\GUIController.cs" />
-     <Compile Include="Assets\scripts\InputController.cs" />
-     <Compile Include="Assets\scripts\PlayerChar.cs" />
-     <Compile Include="Assets\scripts\VirtualPad.cs" />
+     <Compile Include="Assets\Scripts\Button.cs" />
+     <Compile Include="Assets\Scripts\CameraManager.cs" />
+     <Compile Include="Assets\Scripts\GUIManager.cs" />
+     <Compile Include="Assets\Scripts\InputManager.cs" />
+     <Compile Include="Assets\Scripts\PlayerCharacter.cs" />
      <None Include="Assets\RagePixel\readme.txt" />
      <None Include="Assets\RagePixel\Code\RagePixelBasicFlash.shader" />
      <None Include="Assets\RagePixel\Code\RagePixelBasic.shader" />

Assembly-CSharp.pidb

Binary file modified.

Assets/Scripts/Button.cs

+using UnityEngine;
+using System.Collections;
+
+public class Button : MonoBehaviour
+{
+
+	//Storing the reference to RagePixelSprite -component
+	private IRagePixel ragePixel;
+
+	// Enum that manages the button status.
+	public enum ButtonStatus
+	{
+		Normal=0,
+		Pressed
+	};
+
+	void Awake ()
+	{
+		ragePixel = GetComponent<RagePixelSprite> ();
+	}
+	
+	public void Press (ButtonStatus status)
+	{
+		if (status == ButtonStatus.Normal)
+			ragePixel.PlayNamedAnimation ("Normal", false);
+		else
+			ragePixel.PlayNamedAnimation ("Pressed", false);									
+	}
+	
+}

Assets/Scripts/CameraManager.cs

+using UnityEngine;
+using System.Collections;
+using System;
+
+public class CameraManager: MonoBehaviour
+{
+	// The player character to follow.
+	private const string PlayerGoName = "Player";
+	
+	public enum CameraFormat
+	{
+		followTarget=0
+	};
+	public CameraFormat state = CameraFormat.followTarget;
+	private GameObject player;	
+	
+	// Half and quarter screen are used to measuer 50% screen points
+	// And 25% points, to know when to move the camera on followtarget mode
+	private Vector3 halfScreen = new Vector3 (0.5f, 0.5f, 0);
+	private Vector3 quarterScreen = new Vector3 (0.25f, 0.25f, 0);
+	private Vector3 halfDelta;
+	private Vector3 quarterDelta;
+	
+	// The zeroPoint will be used to know when we got to the earliest
+	// part of the map, the onePoint does the same on the other side.
+	// They show the position on the Right bottom corner and left top
+	// corner
+	private Vector3 zeroPoint;
+	private Vector3 onePoint;
+	
+	// The point where the camera will stop following the character 
+	// (meaning the map is over)
+	private int mapXLength = 1000;
+	private int mapYLength = 1000;
+	private Vector3 destination;	
+	 
+	// We'll make it the same as the target speed on load
+	private float cameraSpeed = 50f;
+
+	void Awake ()
+	{
+		SetPixelResolution ();
+		switch (state) {
+		case CameraFormat.followTarget:
+			AwakeFollowTarget ();
+			break;		
+		}
+	}
+	
+	void Update ()
+	{
+		switch (state) {
+		case CameraFormat.followTarget:
+			UpdateFollowTarget ();
+			break;			
+		}
+	}
+
+	// Changes the screen resolution of the camera
+	public void SetPixelResolution ()
+	{
+		int pixelSize = 1;		
+		if (Screen.width >= 960 && Screen.height >= 600) {
+			pixelSize = 2;	
+		}
+		Camera camera = gameObject.camera;
+
+		camera.orthographic = true;
+
+		float screenH = Screen.height;
+		camera.orthographicSize = screenH / 2 / pixelSize;
+	}
+	
+	void AwakeFollowTarget ()
+	{
+		// We get our target, or throw and exception if it's not set		
+		GameObject playerGo = GameObject.Find (PlayerGoName);
+		if (!playerGo)
+			throw new Exception ("Cannot find a gameobject named " + PlayerGoName);
+		player = playerGo;		
+		
+		// Makes the camera follow the character åt the same speed of him.
+		PlayerCharacter pc;
+		if (player) { 
+			pc = (PlayerCharacter)player.GetComponent (typeof(PlayerCharacter));
+			cameraSpeed = pc.walkingSpeed;
+		}		
+	}
+	
+	void UpdateFollowTarget ()
+	{
+		if (player) {	        
+			destination = Vector3.zero;
+			// We want to know if our target will go farther than 50% screen and
+			// less than 25%, in both up and down directions. 
+			// So we'll get the delta of our target and the point of half and quarter the screen. 			
+			halfDelta = player.transform.position - camera.ViewportToWorldPoint (halfScreen);						
+			quarterDelta = player.transform.position - camera.ViewportToWorldPoint (quarterScreen);						
+			
+			// Now we check if we need to move. 
+			// Since we're going pixel based the camera will move in 1 unit ranges (nondecimal).
+			if (halfDelta.x > 0)
+				destination.x = 1;
+			if (halfDelta.y > 0)
+				destination.y = 1;	
+			if (quarterDelta.x < 0)
+				destination.x = -1;
+			if (quarterDelta.y < 0)
+				destination.y = -1;	
+			
+			// Now before we update, we check if we're not on the 0 edge. 
+			// TODO: Vertical movement
+			// Plus we only check it if we're moving
+			if (destination != Vector3.zero) {
+				zeroPoint = camera.ViewportToWorldPoint (Vector3.zero);						
+				onePoint = camera.ViewportToWorldPoint (Vector3.one);
+				if (zeroPoint.x <= 0 && destination.x < 0)
+					destination.x = 0;
+				if (onePoint.x >= mapXLength && destination.x > 0)
+					destination.x = 0;
+			}
+		
+			// Finally we update the camera
+			transform.Translate (destination * Time.deltaTime * cameraSpeed);
+		}				
+	}
+	
+}
+

Assets/Scripts/GUIManager.cs

+using UnityEngine;
+using System.Collections;
+
+public class GUIManager : MonoBehaviour
+{
+	public enum GuiAnchor
+	{
+		bottomLeft=0
+	};
+	public GuiAnchor anchor = GuiAnchor.bottomLeft;
+		
+	void Awake ()
+	{
+		// Let's remove the UI on desktop versions
+		// Later versions will only remove the iphone ui not all
+		#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_MAC || UNITY_WEBPLAYER
+			Destroy(gameObject);
+		#endif
+		
+		// To place this current gui layer on its correct position we'll 
+		// check the camera current 0,0 and set it there.
+		// It is neccesary that the gui objects are always placed under a camera
+		// Since it server for 2 purposes:
+		// a) The gui moves along with it as it's parented. 
+		// b) It uses it to relocate to it's 0,0
+		Camera camera = transform.parent.gameObject.camera;
+		switch (anchor) {
+		case GuiAnchor.bottomLeft:	
+			Vector3 zeroPoint = camera.ViewportToWorldPoint (Vector3.zero);
+			zeroPoint.z = gameObject.transform.position.z;
+			gameObject.transform.position = zeroPoint;			
+			break;
+		}
+
+	}
+}

Assets/Scripts/InputManager.cs

+using UnityEngine;
+using System.Collections;
+using System;
+
+public class InputManager : MonoBehaviour
+{	
+	private const string PlayerGoName = "Player";
+	private const string LeftButtonGoName = "LeftButton";
+	private const string RightButtonGoName = "RightButton";	
+	
+	public enum InputMode
+	{
+		Moving=0
+	};
+	public InputMode InputModeState;
+
+	public enum Key
+	{
+		LeftButton=0,
+		RightButton,
+		AButton,
+		BButton
+	};
+	private int buttonStatus = 0;
+	private int touchStatus = 0;
+	private PlayerCharacter player;
+	private Button leftButton;
+	private Button rightButton;
+	private RaycastHit hit;
+	private Ray ray;
+	
+	void Awake ()
+	{
+		switch (InputModeState) {
+		case InputMode.Moving:
+			AwakeMove ();
+			break;
+		}
+	}
+	
+	void Update ()
+	{
+		switch (InputModeState) {
+		case InputMode.Moving:
+			ManageMove ();
+			break;
+		}
+	}
+	
+	void AwakeMove ()
+	{
+		GameObject playerGo = GameObject.Find (PlayerGoName);
+		if (!playerGo)
+			throw new Exception ("Cannot find a gameobject named " + PlayerGoName);
+		player = (PlayerCharacter)playerGo.GetComponent (typeof(PlayerCharacter));
+		#if UNITY_IPHONE || UNITY_ANDROID
+			GameObject leftButtonGo = GameObject.Find(LeftButtonGoName);
+			GameObject rightButtonGo = GameObject.Find(RightButtonGoName);		
+			if (!leftButtonGo)
+				throw new Exception("Cannot find a gameobject named " + LeftButtonGoName );
+			if (!rightButtonGo)
+				throw new Exception("Cannot find a gameobject named " + RightButtonGoName);
+			leftButton = (Button) leftButtonGo.GetComponent(typeof(Button));
+			rightButton = (Button) rightButtonGo.GetComponent(typeof(Button));		
+		#endif
+	}
+	
+	void ManageMove ()
+	{
+		// First we'll analyse the Movement axis, we'll get, -1 for left and 1 for right.
+		buttonStatus = (int)Input.GetAxis ("Horizontal");
+		foreach (Touch touch in Input.touches) {
+			if (touch.phase == TouchPhase.Began || touch.phase == TouchPhase.Moved) {
+				ray = Camera.main.ScreenPointToRay (touch.position);
+				if (Physics.Raycast (ray, out hit)) {
+					if (hit.transform.gameObject.name == LeftButtonGoName) 
+						touchStatus = -1;
+					else if (hit.transform.gameObject.name == RightButtonGoName)
+						touchStatus = 1;
+				} 
+			} else if (touch.phase == TouchPhase.Ended) {
+				touchStatus = 0;					
+			}
+		}
+		if (buttonStatus == 1 || touchStatus == 1) {
+			player.Move (PlayerCharacter.WalkingState.WalkRight);
+			#if UNITY_IPHONE || UNITY_ANDROID
+				leftButton.Press(Button.ButtonStatus.Normal);
+				rightButton.Press(Button.ButtonStatus.Pressed);		
+			#endif
+		} else if (buttonStatus == -1 || touchStatus == -1) {
+			player.Move (PlayerCharacter.WalkingState.WalkLeft);
+			#if UNITY_IPHONE || UNITY_ANDROID
+				leftButton.Press(Button.ButtonStatus.Pressed);
+				rightButton.Press(Button.ButtonStatus.Normal);
+			#endif
+		} else if (buttonStatus == 0 && touchStatus == 0) {
+			player.Move (PlayerCharacter.WalkingState.Standing);	
+			#if UNITY_IPHONE || UNITY_ANDROID
+				leftButton.Press(Button.ButtonStatus.Normal);
+				rightButton.Press(Button.ButtonStatus.Normal);
+			#endif
+
+		}		
+	}
+}

Assets/Scripts/PlayerCharacter.cs

+using UnityEngine;
+using System.Collections;
+
+public class PlayerCharacter : MonoBehaviour
+{
+
+	private IRagePixel ragePixel;
+     
+	//enum for character state
+	public enum WalkingState
+	{
+		Standing=0,
+		WalkRight,
+		WalkLeft
+	};
+	public WalkingState state = WalkingState.Standing;
+	public bool flipState = false;
+	
+	//walking speed (pixels per second)
+	public float walkingSpeed = 10f;
+
+	void Start ()
+	{
+		ragePixel = GetComponent<RagePixelSprite> ();
+	}
+
+	public void Move (WalkingState direction)
+	{
+		if (direction == WalkingState.WalkRight) {
+			state = WalkingState.WalkRight;
+		} else if (direction == WalkingState.WalkLeft) {
+			state = WalkingState.WalkLeft;									
+		} else {
+			state = WalkingState.Standing;			
+		}		
+	}
+	
+	void Update ()
+	{
+
+		Vector3 moveDirection = new Vector3 ();
+        
+		switch (state) {
+		case(WalkingState.Standing):
+                //Reset the horizontal flip for clarity
+			ragePixel.SetHorizontalFlip (flipState);
+			ragePixel.PlayNamedAnimation ("Stand", false);
+			break;
+
+		case (WalkingState.WalkLeft):
+				//Not flipping horizontally. Our animation is drawn to walk right.
+			flipState = false;
+			ragePixel.SetHorizontalFlip (flipState);
+                //PlayAnimation with forceRestart=false. If the WALK animation is already running, doesn't do anything. Otherwise restarts.
+			ragePixel.PlayNamedAnimation ("Walk", false);
+                //Move direction. X grows right so left is -1.
+			moveDirection = new Vector3 (-1f, 0f, 0f);
+			break;
+
+		case (WalkingState.WalkRight):
+                //Flip horizontally. Our animation is drawn to walk left.
+			flipState = true;
+			ragePixel.SetHorizontalFlip (flipState);
+                //PlayAnimation with forceRestart=false. If the WALK animation is already running, doesn't do anything. Otherwise restarts.
+			ragePixel.PlayNamedAnimation ("Walk", false);
+                //Move direction. X grows right so left is +1.
+			moveDirection = new Vector3 (1f, 0f, 0f);
+			break;
+		}
+		//Move the sprite into moveDirection at walkingSpeed pixels/sec
+		transform.Translate (moveDirection * Time.deltaTime * walkingSpeed);
+	}
+}

Assets/scripts/CameraController.cs

-using UnityEngine;
-using System.Collections;
-using System;
-
-public class CameraController: MonoBehaviour
-{
-	// The player character to follow.
-	private const string PlayerGoName = "Player";
-	
-	public enum CameraFormat {followTarget=0};
-	public CameraFormat state = CameraFormat.followTarget;
-		
-	private GameObject player;	
-	
-	// Half and quarter screen are used to measuer 50% screen points
-	// And 25% points, to know when to move the camera on followtarget mode
-	private Vector3 halfScreen = new Vector3(0.5f,0.5f,0);
-	private Vector3 quarterScreen = new Vector3(0.25f,0.25f,0);
-	
-	private Vector3 halfDelta;
-	private Vector3 quarterDelta;
-	
-	// The zeroPoint will be used to know when we got to the earliest
-	// part of the map, the onePoint does the same on the other side.
-	// They show the position on the Right bottom corner and left top
-	// corner
-	private Vector3 zeroPoint;
-	private Vector3 onePoint;
-	
-	// The point where the camera will stop following the character 
-	// (meaning the map is over)
-	private int mapXLength = 1000;
-	private int mapYLength = 1000;	
-	
-	private Vector3 destination;	
-	 
-	// We'll make it the same as the target speed on load
-    private float cameraSpeed = 50f;	
-
-	void Awake () {
-		setPixelResolution();
-		switch (this.state) {
-			case CameraFormat.followTarget:
-				awakeFollowTarget();
-				break;		
-		}
-	}
-	
-	void Update () {
-		switch (this.state) {
-			case CameraFormat.followTarget:
-			updateFollowTarget();
-			break;			
-		}
-	}
-
-	// Changes the screen resolution of the camera
-    public void setPixelResolution()
-    {
-		int pixelSize = 1;		
-		if (Screen.width >= 960 && Screen.height >= 600) {
-			pixelSize = 2;	
-		}
-		Camera camera = gameObject.camera;
-
-		camera.orthographic = true;
-
-		float screenH = Screen.height;
-        camera.orthographicSize = screenH / 2 / pixelSize;
-    }	
-			
-	
-	
-	void awakeFollowTarget() {
-		// We get our target, or throw and exception if it's not set		
-		GameObject playerGo = GameObject.Find(PlayerGoName);
-		if (!playerGo)
-			throw new Exception("Cannot find a gameobject named " + PlayerGoName);
-		this.player = playerGo;		
-		
-		// Makes the camera follow the character åt the same speed of him.
-		PlayerChar pc;
-		if (player) { 
-			pc = (PlayerChar)player.GetComponent(typeof(PlayerChar));
-			this.cameraSpeed = pc.walkingSpeed;
-		}		
-	}
-	
-	void updateFollowTarget() {
-	    if(player) {	        
-			destination = Vector3.zero;
-			// We want to know if our target will go farther than 50% screen and
-			// less than 25%, in both up and down directions. 
-			// So we'll get the delta of our target and the point of half and quarter the screen. 			
-			halfDelta = player.transform.position - camera.ViewportToWorldPoint(halfScreen);						
-			quarterDelta = player.transform.position - camera.ViewportToWorldPoint(quarterScreen);						
-			
-			// Now we check if we need to move. 
-			// Since we're going pixel based the camera will move in 1 unit ranges (nondecimal).
-			if (halfDelta.x > 0)
-				destination.x = 1;
-			if (halfDelta.y > 0)
-				destination.y = 1;	
-			if (quarterDelta.x < 0)
-				destination.x = -1;
-			if (quarterDelta.y < 0)
-				destination.y = -1;	
-			
-			// Now before we update, we check if we're not on the 0 edge. 
-			// TODO: Vertical movement
-			// Plus we only check it if we're moving
-			if (destination != Vector3.zero) {
-				zeroPoint = camera.ViewportToWorldPoint(Vector3.zero);						
-				onePoint = camera.ViewportToWorldPoint(Vector3.one);
-				if (zeroPoint.x <= 0 && destination.x < 0)
-					destination.x = 0;
-				if (onePoint.x >=  mapXLength && destination.x > 0)
-					destination.x = 0;
-			}
-		
-			// Finally we update the camera
-			transform.Translate(destination * Time.deltaTime * this.cameraSpeed);
-		}				
-	}
-	
-}
-

Assets/scripts/GUIController.cs

-using UnityEngine;
-using System.Collections;
-
-public class GUIController : MonoBehaviour
-{
-	public enum GuiAnchor {bottomLeft=0};
-	public GuiAnchor anchor = GuiAnchor.bottomLeft;
-		
-	void Awake ()
-	{
-		// It removes the UI on desktop versions
-		#if UNITY_STANDALONE_WIN || UNITY_STANDALONE_MAC || UNITY_WEBPLAYER
-			Destroy(this.gameObject);
-		#endif
-		
-		// To place this current gui layer on its correct position we'll 
-		// check the camera current 0,0 and set it there.
-		// It is neccesary that the gui objects are always placed under a camera
-		// Since it server for 2 purposes:
-		// a) The gui moves along with it as it's parented. 
-		// b) It uses it to relocate to it's 0,0
-		Camera camera = transform.parent.gameObject.camera;
-		switch (anchor) {
-			case GuiAnchor.bottomLeft:	
-				Vector3 zeroPoint = camera.ViewportToWorldPoint(Vector3.zero);
-				zeroPoint.z = this.gameObject.transform.position.z;
-				this.gameObject.transform.position = zeroPoint;			
-			break;
-		}
-
-	}
-}

Assets/scripts/InputController.cs

-using UnityEngine;
-using System.Collections;
-using System;
-
-public class InputController : MonoBehaviour {	
-	private const string PlayerGoName = "Player";
-	private const string LeftButtonGoName = "LeftButton";
-	private const string RightButtonGoName = "RightButton";	
-	
-	public enum InputMode {Moving=0};
-	public InputMode InputModeState;
-
-	public enum Key {LeftButton=0, RightButton, AButton, BButton};
-	private int buttonStatus = 0;
-	private int touchStatus = 0;
-
-	private PlayerChar player;
-	private VirtualPad leftButton;
-	private VirtualPad rightButton;
-	private RaycastHit hit;
-	private Ray ray;
-	
-	void Awake() {
-		Debug.Log("input controller");
-		switch (this.InputModeState) {
-			case InputMode.Moving:
-				awakeMove();
-				break;
-		}
-	}
-	
-	void Update() {
-		switch (this.InputModeState) {
-			case InputMode.Moving:
-				manageMove();
-				break;
-		}
-	}
-	
-	void awakeMove() {
-		GameObject playerGo = GameObject.Find(PlayerGoName);
-		if (!playerGo)
-			throw new Exception("Cannot find a gameobject named " + PlayerGoName);
-		this.player = (PlayerChar) playerGo.GetComponent(typeof(PlayerChar));
-
-		#if UNITY_IPHONE || UNITY_ANDROID
-			GameObject leftButtonGo = GameObject.Find(LeftButtonGoName);
-			GameObject rightButtonGo = GameObject.Find(RightButtonGoName);		
-			if (!leftButtonGo)
-				throw new Exception("Cannot find a gameobject named " + LeftButtonGoName );
-			if (!rightButtonGo)
-				throw new Exception("Cannot find a gameobject named " + RightButtonGoName);
-			this.leftButton = (VirtualPad) leftButtonGo.GetComponent(typeof(VirtualPad));
-			this.rightButton = (VirtualPad) rightButtonGo.GetComponent(typeof(VirtualPad));		
-		#endif
-	}
-	
-	void manageMove() {
-		// First we'll analyse the Movement axis, we'll get, -1 for left and 1 for right.
-		buttonStatus = (int)Input.GetAxis("Horizontal");
-		foreach (Touch touch in Input.touches) {
-	        if (touch.phase == TouchPhase.Began || touch.phase == TouchPhase.Moved) {
-	            ray = Camera.main.ScreenPointToRay(touch.position);
-	            if (Physics.Raycast (ray, out hit)) {
-					if (hit.transform.gameObject.name == LeftButtonGoName) 
-						touchStatus = -1;
-					else if (hit.transform.gameObject.name == RightButtonGoName)
-						touchStatus = 1;
-				} 
-	        } else if (touch.phase == TouchPhase.Ended) {
-				touchStatus = 0;					
-			}
-	    }
-		if (buttonStatus == 1 || touchStatus == 1) {
-			player.move(PlayerChar.WalkingState.WalkRight);
-			#if UNITY_IPHONE || UNITY_ANDROID
-				leftButton.press(VirtualPad.ButtonStatus.Normal);
-				rightButton.press(VirtualPad.ButtonStatus.Pressed);		
-			#endif
-		} else if (buttonStatus == -1 || touchStatus == -1)  {
-			player.move(PlayerChar.WalkingState.WalkLeft);
-			#if UNITY_IPHONE || UNITY_ANDROID
-				leftButton.press(VirtualPad.ButtonStatus.Pressed);
-				rightButton.press(VirtualPad.ButtonStatus.Normal);
-			#endif
-		} else if (buttonStatus == 0 && touchStatus == 0) {
-			player.move(PlayerChar.WalkingState.Standing);	
-			#if UNITY_IPHONE || UNITY_ANDROID
-				leftButton.press(VirtualPad.ButtonStatus.Normal);
-				rightButton.press(VirtualPad.ButtonStatus.Normal);
-			#endif
-
-		}		
-	}
-}

Assets/scripts/PlayerChar.cs

-using UnityEngine;
-using System.Collections;
-
-public class PlayerChar : MonoBehaviour {
-
-    private IRagePixel ragePixel;
-     
-    //enum for character state
-    public enum WalkingState {Standing=0, WalkRight, WalkLeft};
-    public WalkingState state = WalkingState.Standing;
-
-	public bool flipState = false;
-	
-    //walking speed (pixels per second)
-    public float walkingSpeed = 10f;
-
-    void Start () {
-        ragePixel = GetComponent<RagePixelSprite>();
-    }
-
-	public void move(WalkingState direction) {
-		if (direction == WalkingState.WalkRight) {
-            state = WalkingState.WalkRight;
-		} else if (direction == WalkingState.WalkLeft) {
-			state = WalkingState.WalkLeft;									
-		} else {
-            state = WalkingState.Standing;			
-		}		
-	}
-	
-    void Update () {
-
-        Vector3 moveDirection = new Vector3();
-        
-        switch (state)
-        {
-            case(WalkingState.Standing):
-                //Reset the horizontal flip for clarity
-                ragePixel.SetHorizontalFlip(flipState);
-                ragePixel.PlayNamedAnimation("Stand", false);
-                break;
-
-            case (WalkingState.WalkLeft):
-				//Not flipping horizontally. Our animation is drawn to walk right.
-				this.flipState = false;
-				ragePixel.SetHorizontalFlip(flipState);
-                //PlayAnimation with forceRestart=false. If the WALK animation is already running, doesn't do anything. Otherwise restarts.
-                ragePixel.PlayNamedAnimation("Walk", false);
-                //Move direction. X grows right so left is -1.
-                moveDirection = new Vector3(-1f, 0f, 0f);
-                break;
-
-            case (WalkingState.WalkRight):
-                //Flip horizontally. Our animation is drawn to walk left.
-				this.flipState = true;
-				ragePixel.SetHorizontalFlip(flipState);
-                //PlayAnimation with forceRestart=false. If the WALK animation is already running, doesn't do anything. Otherwise restarts.
-                ragePixel.PlayNamedAnimation("Walk", false);
-                //Move direction. X grows right so left is +1.
-                moveDirection = new Vector3(1f, 0f, 0f);
-                break;
-        }
-        //Move the sprite into moveDirection at walkingSpeed pixels/sec
-        transform.Translate(moveDirection * Time.deltaTime * walkingSpeed);
-    }
-}

Assets/scripts/VirtualPad.cs

-using UnityEngine;
-using System.Collections;
-
-public class VirtualPad : MonoBehaviour {
-
-	//Storing the reference to RagePixelSprite -component
-    private IRagePixel ragePixel;
-
-	// Enum that manages the button status.
-	public enum ButtonStatus {Normal=0, Pressed};
-
-	void Awake() {
-        ragePixel = GetComponent<RagePixelSprite>();
-	}
-	
-	public void press(ButtonStatus status) {
-		if (status == ButtonStatus.Normal)
-            ragePixel.PlayNamedAnimation("Normal", false);				
-		else
-            ragePixel.PlayNamedAnimation("Pressed", false);									
-	}
-	
-}

Library/AssetImportState

-9;0;-1
+13;0;-1

Library/EditorUserBuildSettings.asset

Binary file modified.

Library/guidmapper

Binary file modified.

Library/metadata/17/177db863d1cf54b1b9e439f041143507

Binary file modified.

Library/metadata/20/20a83b95cf3dd4813a57f0f7956a6931

Binary file removed.

Library/metadata/26/26f6dee61eba9470183df1d32de9806b

Binary file modified.

Library/metadata/33/33e326721a4ce41fd9197cf4e3c68eb9

Binary file modified.

Library/metadata/36/36775166bb44d447db7d7b89fbeffd0c

Binary file modified.

Library/metadata/3b/3b33700a007404f0ab1f832b37b7b797

Binary file modified.

Library/metadata/44/44278af768a09498f81d2830a0b1d06d

Binary file modified.

Library/metadata/4c/4c5ee024db66e41a7988be833beefd47

Binary file modified.

Library/metadata/68/68e1a4176b6c24dd4a3055666adfd443

Binary file modified.

Library/metadata/69/69351fbd8b5b543a2830d4b68449b35c

Binary file modified.

Library/metadata/78/78504c981f48047dfa4f99ba0529242d

Binary file modified.

Library/metadata/79/79625ace74169415bba087e2ce9d7ca2

Binary file modified.

Library/metadata/79/799f1a4b0eaf04cf0bc2bcae8ff124eb

Binary file modified.

Library/metadata/81/8169f46c972584e05b31547ea69a85de

Binary file modified.

Library/metadata/85/85e37abe2bd0049b2884d2c4828c4b1c

Binary file modified.

Library/metadata/86/86ddd937824e14106a69852e036419d6

Binary file modified.

Library/metadata/94/94b8d0c0203984b71a7a08926bfb21e5

Binary file modified.

Library/metadata/9e/9e6db0b2682d741c5b9413ca6d0a4082

Binary file modified.

Library/metadata/bf/bfdc361f8eaf94ba3940d9ea57cd1c85

Binary file modified.

Library/metadata/dd/ddd4045b8f81348f5ba8ba18e13ab1ee

Binary file modified.

Library/metadata/e1/e15270c74e9bb457893652239a7595ab

Binary file modified.

Library/metadata/e8/e8d0b74daf2334bff98b9be8c0b604a1

Binary file modified.

Library/metadata/f9/f9de539a2d937460ea7d9901ec9f477b

Binary file modified.

Library/metadata/f9/f9f3f10bd1e5948fa8a1ff1dcb82c3d3

Binary file modified.

twisted-potions-double-trouble-csharp.sln

 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
-															GlobalSection(MonoDevelopProperties) = preSolution
+																							GlobalSection(MonoDevelopProperties) = preSolution
 		StartupItem = Assembly-CSharp.csproj
 		Policies = $0
 		$0.TextStylePolicy = $1

twisted-potions-double-trouble.sln

 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
-														GlobalSection(MonoDevelopProperties) = preSolution
+																						GlobalSection(MonoDevelopProperties) = preSolution
 		StartupItem = Assembly-CSharp.csproj
 		Policies = $0
 		$0.TextStylePolicy = $1

twisted-potions-double-trouble.userprefs

 <Properties>
   <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="GuiController.cs">
-    <Files>
-      <File FileName="GuiController.cs" Line="6" Column="2" />
-    </Files>
-  </MonoDevelop.Ide.Workbench>
+  <MonoDevelop.Ide.Workbench />
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
     <BreakpointStore />
   </MonoDevelop.Ide.DebuggingService.Breakpoints>