Hello, I’ve been working on a new project… never had this issue before though. I’m using EasyTouch, but I’ve run into this with other things. As it is the same Asset I used in my last game with no problems.
I made a variable for the sake of recording it’s touch position. I have a character, and I want to be able to have it change directions, if you touch on the left side or the ride side of him. Except my character is at around -25 units on the X axis. When I touch around him, it’s such a huge different. Around position 600 units on the X axis.
Does anyone know what might be causing such a large offset?
It’s not in the code, because I only have a few lines… only asking if gesture.position.x < the game objects position. or greater.
Edit: Here is the code I used (attached to the camera), I have also noticed… the character twitches and can’t move past a certain point (it auto-flips him back around).
var mainCharacter : exSpriteAnimation;
var mainCharacterBase : exSprite;
var mainCharacterObject : GameObject;
var touchx : float;
var touchy : float;
function Start()
{
mainCharacter.Play("idle");
}
function On_TouchStart(gesture:Gesture)
{
// Play "walk right" animation if touch at ground level
if(gesture.position.x > mainCharacterObject.transform.position.x){
mainCharacter.Play("walk");
mainCharacterObject.transform.position.y = mainCharacterObject.transform.position.y - 8;
mainCharacterObject.transform.eulerAngles.y = 0;
}
// Play "walk right" animation if touch at ground level
if(gesture.position.x < mainCharacterObject.transform.position.x){
mainCharacter.Play("walk");
mainCharacterObject.transform.position.y = mainCharacterObject.transform.position.y - 8;
mainCharacterObject.transform.eulerAngles.y = 180;
}
}
function On_TouchDown(gesture:Gesture)
{
// Translate "walk right" animation if touch at ground level
if(gesture.position.x > mainCharacterObject.transform.position.x){
mainCharacterObject.transform.Translate(2,0,0);
mainCharacterObject.transform.eulerAngles.y = 0;
}
// Translate "walk right" animation if touch at ground level
if(gesture.position.x < mainCharacterObject.transform.position.x){
mainCharacterObject.transform.Translate(2,0,0);
mainCharacterObject.transform.eulerAngles.y = 180;
}
}
function On_TouchUp(gesture:Gesture)
{
mainCharacter.Play("idle");
mainCharacterObject.transform.position.y = mainCharacterObject.transform.position.y + 8;
}