Game Development Reference
In-Depth Information
VibratoSpeed
SquareDuty
DutySweep
RepeatSweep
PhaserSweep
LowPassFilterCutOff
LowPassFilterCutOffSweep
LowPassFilterResonance
HighPassFilterCutOff
HighPassFilterCutOffSweep
Volume
The accelerometer returns the gravitational acceleration. The data from the accelerometer can be
obtained from the Gravity variable, which has x, y, and z as its members.
ht = HEIGHT - 20
function draw()
text(Gravity.x, 100,ht)
text(Gravity.y, 200,ht)
text(Gravity.z, 300,ht)
end
Now you can watch the numbers change as you tilt the iPad around.
GravityX = 0
GravityY = 0
supportedOrientation(LANDSCAPE_LEFT)
function setup()
watch("Gravity")
end
function draw()
GravityX = Gravity.x
GravityY = Gravity.y
background(127,127,127,255)
stroke(255,255,255,255)
 
Search WWH ::




Custom Search