Note that there are some explanatory texts on larger screens.

plurals
  1. POIPHONE SDK, How to put Void function into my BOOL??? PLEASE!
    text
    copied!<p>I am using the IPhone's Accelerometer to make a object move. I want to be able to make this function work and not work depending on different states. </p> <p>I have my code for my Accelerometer function and i want to put it into a BOOL so i can call on it when i need it, but i am having problems. Can anyone Help me put this code into a BOOL named:</p> <pre><code>-(BOOL) accelerometerWorks -(void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration{ valueX = acceleration.x*25.5; int newX = (int)(ball.center.x +valueX); if (newX &gt; 320-BALL_RADIUS) newX = 320-BALL_RADIUS; if (newX &lt; 0+BALL_RADIUS) newX = 0+BALL_RADIUS; int XA = (int)(balloonbit1.center.x +valueX); if (XA &gt; 320-BALL_RADIUS) XA = 320-BALL_RADIUS; if (XA &lt; 0+BALL_RADIUS) XA = 0+BALL_RADIUS; int XB = (int)(balloonbit2.center.x +valueX); if (XB &gt; 320-BALL_RADIUS) XB = 320-BALL_RADIUS; if (XB &lt; 0+BALL_RADIUS) XB = 0+BALL_RADIUS; int XE = (int)(balloonbit5.center.x +valueX); if (XE &gt; 320-BALL_RADIUS) XE = 320-BALL_RADIUS; if (XE &lt; 0+BALL_RADIUS) XE = 0+BALL_RADIUS; int XF = (int)(balloonbit6.center.x +valueX); if (XF &gt; 320-BALL_RADIUS) XF = 320-BALL_RADIUS; if (XF &lt; 0+BALL_RADIUS) XF = 0+BALL_RADIUS; int XH = (int)(balloonbit8.center.x +valueX); if (XH &gt; 320-BALL_RADIUS) XH = 320-BALL_RADIUS; if (XH &lt; 0+BALL_RADIUS) XH = 0+BALL_RADIUS; ball.center = CGPointMake (newX, 415); balloonbit1.center = CGPointMake (XA, 408); balloonbit2.center = CGPointMake (XB, 395); balloonbit5.center = CGPointMake (XE, 388); balloonbit6.center = CGPointMake (XF, 413); balloonbit8.center = CGPointMake (XH, 426); } </code></pre> <p>Please help. i have been trying for ages with no success. Thanks. Harry.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload