How do I plot a value or create a line graph?

Get help using Construct 2

Post » Fri Jul 24, 2015 4:19 pm

I want to add a rectangle that tracks one of the global variables and how it changes over time. The simplest way to do this is with a line graph.

I've found several suggestions in the forum including using the Canvas plugin and I wanted to check to see what the current thinking is on the topic. Is there a best way to do it? A plugin that people often use? Another tool?

Thanks very much in advance.
B
4
Posts: 5
Reputation: 217

Post » Fri Jul 24, 2015 4:25 pm

The canvas plugin is probably the best way to do it. Using multiple "Tiled Background" objects and turning them into lines could be an option too.
B
67
S
28
G
24
Posts: 970
Reputation: 18,675

Post » Fri Jul 24, 2015 4:38 pm

The canvas plug is a great way to do it.

Athough you can also do it with sprites. Make a sprite that is a short line. set the origin at one end of the line. Set the sprite's position to the first x,y coordinates you want to plot. set the angle of the sprite to the next x,y coordinate, then set the width of the sprite to the distance between the two points - using Distance(x1,y1,x2,y2).

You can see an example of plotting lines like this in the 3d star map tutorial I did last year. https://www.scirra.com/tutorials/774/3d-star-map. Click on a star, then click on another one... The capx is available to play with.
B
94
S
33
G
20
Posts: 438
Reputation: 17,615

Post » Fri Jul 24, 2015 5:30 pm

The Tiled Background is probably more appropriate for this since the bitmap won't get weirdly stretched in the resize process.
B
67
S
28
G
24
Posts: 970
Reputation: 18,675

Post » Fri Jul 24, 2015 5:34 pm

Thanks!
B
4
Posts: 5
Reputation: 217

Post » Fri Jul 24, 2015 9:07 pm

B
21
S
8
G
6
Posts: 177
Reputation: 8,124


Return to How do I....?

Who is online

Users browsing this forum: Malhog and 19 guests