storing/plotting data?

Get help using Construct 2

Post » Thu Nov 28, 2013 12:57 am

is there a way in construct to store data from say, the accelerometer outputs and then plot the data in a graph?

thanks
Dan
B
8
S
3
G
1
Posts: 87
Reputation: 1,493

Post » Thu Nov 28, 2013 1:13 am

1D array

recording = 0

event that starts recording: set size array to 0,1,1
set recording = 1

every tick AND recording = 1: push array at back x-axis, value = touch.AccelerationX (or whichever value you are interested in)

to stop recording set recording to 0 again.

to plot it, by using the canvas plugin:

~event that starts the plotting~: canvas begin path
canvas path move to start point
- for 0 to array.width-1: canvas line to x=loopindex y=300-array.at(loopindex)
- canvas draw line

If you want a continuos plot, you probably need to draw the (complete) line each tick instead and if there are more than maybe 200 elements in the array, you delete the first array OR for a more simple approach spawn a small pixel every tick with the bullet behaviour at the right and let it move to the right and destroy when it is off the graph.mindfaQ2013-11-28 01:24:06
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788


Return to How do I....?

Who is online

Users browsing this forum: TRMG and 41 guests