Hi.
I want make shooter game for iPhone, but I want when touch the screen player can shoot and when rotate iPhone to right or left, character can move. how can do it?
Thanks
			

Vector myvector = getAccelerometer();
// Declare our tilt variable.=
Vector tilt = getAccelerometer();
// The IF statements give us a "deadzone"
// so that tiny shakes when holding the device
// don't move it around
// Increase "0.2" for a bigger deadzone
if (tilt.y > 0.2) 
{
    // This adds to the X value of our actor based
    // on how far we're tilting the device. Adjusting
    // the "10" will change how sensitive it is
    x = x + (tilt.y * 10);
}
// Decrease "-0.2" for a bigger deadzone
if (tilt.y < -0.2)
{
    // We use "ABS" to change the currently negative
    // value of "tilt.x" into a positive number,
    // easier to manage. 
    x = x - (abs(tilt.y) * 10);
}


 
 

Users browsing this forum: No registered users and 1 guest