I am working on a game that has a few classes. I want the laser to recognize when it hits a meteor. I cannot figure out how to get the width of the meteors(array) and the laser(just a line) to see something like if( laser > meteor.width && laser < meteor.width). Something like that. I have the meteor in one class, and the laser in another, while moving it to a game class. One issue is that i am using mouseX for the laser position, and that I cant get any of the variables in so that i can have the impact. On an added note, i want the meteor to reset at the top if hit. Anyone know how to get this to work?
I want to shoot a laser from my player, from the bottom to the top. I have the laser shooting upwards, but the problem is that if i hold down the mouse button the laser stays on, i want it to shoot to the top, and go away until you click again. If anyone could help me solve this problem i would appreciate it. This is for a game so it could be used to cheat in a way. This is the code i have
I am trying to put images of the first 5 planets around the sun. The code is based off of the learning processing book example, there is a sun and ellipses rotating around the sun. I want to replace the ellipses with the pictures of the planets, with somewhat accurate scaled dimensions. Wasn't sure how to go about this, I've done it using an array and changing the names to planet_0, planet_1 and so forth. having it say loadImage("planet_" + planetnum + ".png"). But cant get the sizes or distances to scale. any help of the right approach to take, or guides would be helpful.
I am trying to get a grid made from an array to change colors with a left click or right click, left turns it black, and right turns it yellow. But when i click it turns the whole thing turns to a color instead of the individual boxes. any help would be appreciated. here is the code
I want to take the grid and be able to change the inside of one of the rectangles to a random color when you click inside of it, have made many attempts but cannot figure out how it is done. here is the grid i have.
I have been working on a game for class, and i have a ellipse falling, you want to avoid it as long as possible for a higher score, but i want more than just one falling. i wasn't sure what i would have to do to turn that one circle into more over time.