How do I create a custom shape using my custom plugin.

Get help using Construct 2

Post » Tue Jun 21, 2016 12:38 pm

Message: nlacroixcforp can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hi,

For my c2 project I would like to create a pentagon graph to show the player's stats.

Example: http://media.eventhubs.com/images/2015/12/24_attributecharts.jpg

This would be builded using multiple coordinates and would be rendered through a custom plugin (or is there an easier way inside the software ?).

Anyway I'm trying to render a shape but my code is executed and nothing is showing inside the canvas.

Here's what I am trying :


var context = document.getElementById('c2canvas').getContext('2d');

context.beginPath();
context.moveTo(387, 256);
context.rect(188, 50, 200, 100);
context.fillStyle = 'yellow';
context.fill();
context.lineWidth = 7;
context.strokeStyle = 'black';
context.stroke();

I tried it inside instanceProto.draw = function(ctx) and inside a window.onload function.


My question is why is the shape not rendering, and if it renders can I manipulate it inside c2?

Thanks,

Nic L

Web programmer - CFORP
B
5
Posts: 12
Reputation: 249

Post » Tue Jun 21, 2016 2:51 pm

@nlacroixcforp
I would use ROJOhounds Canvas plugin, you can draw paths and flood fill...

https://www.scirra.com/forum/plugin-canvas_t64239?&hilit=canvas
B
96
S
33
G
20
Posts: 438
Reputation: 17,665


Return to How do I....?

Who is online

Users browsing this forum: mcscooter, TRMG and 33 guests