We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Working on card game program using object and a separate class. Using this to call for a font that is later used in the following. Keep getting an error 'Cannot find anything named "MyFont". Obviously entire program not shown.
This worked in a previous program and did not have to use Tools to insert a font. Tried that and did not work. Am new at this, but don't understand why this isn't working this time.
background(0);
textFont(myFont);
text(leftPoint, 75, 50);
text(rightPoint, 515, 50);
rect(200, 400, 200, 100);
for (int i=0; i<20; i++)
{
myCard[i].display(); //display cards on the screen
}
if (leftDeck>19) //CHANGE means went throug all the cards
{
if (leftPoint > rightPoint)
{
text("Left Wins!", 250, 350);
} else if (leftPoint<rightPoint)
{
text("Right Wins!", 250, 350);
} else
{
text("you TIED!!!!", 250, 350);
}
}
}
Answers
PFont myFont = createFont(...
Be sure to use myFont, not MyFont or Myfont or mYfOnT.
Thank you, will check!
only 2 places for the code and I showed the exact copy of the 'createfont' and it's use in the program. I can post the code if you would take a look. Thanks!
We don't see where myFont is declared, where it is initialized, only where it is used, ie. you just show us the code where you have no problem... Hard to help.
Okay, was staaaaaring too hard at what I did. went back prior to the background section
PFont myFont;
your answer would work as well - which I found once I got some sleep. Thanks!
Have been away with family situations!
If only 1 PFont is gonna be used across whole sketch, there's no need to keep a variable for it: *-:)
textFont( createFont("Verdana", 48, true) );