View Single Post
  #2  
Old 01-06-2011, 10:19 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by fowlplay4 View Post
This was posted way back when in the Classic iPhone thread.

PHP Code:
xaxis = -(getangle(getAcceleratorAxis(0), getAcceleratorAxis(1)) - pi); // stays at pi/2
yaxis getAcceleratorAxis(2); // stays at 0 
Doesn't work.
I made this on Classic iPhone Dev

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
enableAccelerator(true);
  
createProfile(); 
  
this.running true;
  
  new 
GuiProgressCtrl("x_progress") {
    
profile axisprofile;
    
useownprofile true;        
    
resize(501520025);
    
progress .5;
  }

  new 
GuiProgressCtrl("y_progress") {
    
profile axisprofile;
    
useownprofile true;        
    
resize(503520025);
    
progress .5;
  }

  new 
GuiProgressCtrl("z_progress") {
    
profile axisprofile;
    
useownprofile true;        
    
resize(505520025);
    
progress .5;
  }
  
setTimer(0.05);
}

function 
onPlayerChats() {
  if (
player.chat == ":toggleaxis") {
    
this.running = !this.running;
    
    if (
this.running) {
      
enableAccelerator(true);
      if (
timeout <= 0)
        
setTimer(0.1);
    }
    else {
      
enableAccelerator(false);
      
setTimer(0);
    }
  }
}

function 
onTimeout() {
  
temp.xaxis = (roundto(getAcceleratorAxis(0), 0.05))/2;
  
temp.yaxis = (roundto(getAcceleratorAxis(1), 0.05))/2;
  
temp.zaxis = (roundto(getAcceleratorAxis(2), 0.05))/2;

  
x_progress.progress temp.xaxis+.5;
  
y_progress.progress temp.yaxis+.5;
  
z_progress.progress temp.zaxis+.5;    
  
setTimer(0.25);
}

function 
roundto(valdec)
  return 
int(val/dec 0.5) * dec;

function 
createProfile() {
  new 
GuiProgressProfile("axisprofile") {
    
this.copyfrom("GuiBlueProgressProfile");
    
bordercolor={0,0,0};
    
bordercolorhl={0,0,0};
    
bordercolorna={0,0,0};
    
fillcolor={255,0,0};
    
fillcolorhl={255,0,0};
    
fillcolorna={255,0,0};
  }

I found each axis has a value between -1 and 1. The bars make it quite easy to follow
Reply With Quote