storing/plotting data?

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

    thanks

    Dan

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)