P5.js sharing the same shape coordinates, why?

Hi there,

I’m on my lesson at p5.js which how to illustrate shapes and coordinates that come with it. It didn’t really explain why do we have to input the same coordinates as the previous shape done for? For example, the lesson asked me to dial in the triangle() and apply numbers, and then it asked me again to share the same code? I just need a better explanation for this, thank you!

Hi @denzelsugayan6884482 ,

Please supply us with a link to the specific exercise to which you are referring, so that we can look at the information and instructions that are given.

Oh sure, my bad, here’s the lesson I was talking about https://www.codecademy.com/courses/learn-p5js/lessons/p5js-drawing-shapes/exercises/p5js-triangle-quad

1 Like

The exercise doesn’t ask you to use the same coordinates for the second shape as for the first one. The two triangles and the two quadrilateral should just touch each other at a single point. Does that answer the question?

2 Likes

Yes, the second triangle should share one vertex with the first triangle, and the second quadrilateral should share one vertex with the first quadrilateral. Here’s an example with triangles:

image

They share vertices at coordinates 210, 190.

1 Like