Game Development Reference
In-Depth Information
Recording Video
Codea has built-in functions for recording video. The functions for working with video recording are
simple:
startRecording
: You can start the recording by calling this function. Do not call
this function from within the
setup
function.
stopRecording
: You can stop recording by calling this function. When we stop
recording, the video is saved to the device's camera roll.
isRecording
: With this function, you can query if something is currently being
recording.
touched
function. Each touch point
id
: The unique identifier for the touch
x
: The x position of the touch on the screen
y
: The y position of the touch on the screen
prevX
: The x position from the previous frame of the touch
prevY
: The y position from the previous frame of the touch
deltaX
: The amount the touch has moved on the x-axis
deltaY
: The amount the touch has moved on the y-axis
state
: The state of the touch, which can be
BEGAN
,
MOVING
, or
ENDED
tapCount
: The number of times the touch point has been tapped
There is a global variable called
CurrentTouch
that contains the most recent touch on the screen.
Here's an example of its use:
function draw()
background(0)
fill(255)
ellipse(CurrentTouch.x, CurrentTouch.y, 300)
end
This code produces a white circle on the screen that looks like a spotlight and moves with the touch
as you glide the finger across the screen.