Trying to create a shape/load image in a class and call it in my draw (not working)

Sorry this is a two part question but it is kind of the same question, I taught myself processing so hence I am not sure how to figure this out myself.

  1. So, I made a drawBird() function in my bird class and then in my Main I tried calling it using b.drawbird().
    This works if my code is a simple shape like:
    ellipse(xPos, yPos, 20, 20);

But once I try doing complex that requires me adding different shapes together, ex. if I had lines and arc in that function. Something like:

  ellipse(250, 400, 20, 20);
  line(240, 400, 260, 400);
  line(240, 403, 260, 403);
  arc(263, 375, 50, 50, 0, HALF_PI);
  arc(250, 372, 60, 60, HALF_PI + QUARTER_PI/2, PI);

and then call this in my main, it doesn’t work the same. I tried grouping the shape using createShape(), but was having the same problem.

  1. Also would it be possible use an image in my drawBird() and then use that in my Main draw function. I tried loadImage(), but it didnt work out like I thought.

if you need any explanations feel free to ask, thanks a lot :slight_smile:

1 Like

please we need more error description,

what i see is that in the first code part you use variables xPos yPos
but not in the second part? why ?

try to learn about image load and display first outside your project and class… structure.

1 Like

Oh my, I feel so stupid. I forgot to use xPos and yPos for my new shape. Thanks so much for pointing that out!! :smiley:

1 Like