I'm creating a maze game for a project at my university. It's a maze game and I want the character to detect if a color near them is black and if they are moving in that direction they will stop moving in that direction. Basically I'm trying to do collision detection with color. When I try to display my Player character it just displays a grayish screen. I'm not sure exactly why my code isn't displaying the character. I have a file "hero.png" in the same folder as my .pde. Any suggestions?
Coding a billiards game for a class project. My goal is to click the mouse once to place a cue ball, again to place a target ball, and then a third click will send the cue ball towards the target ball. When the cue ball collides with the target ball, the cue ball is supposed to stop and the target ball should start moving. The cue ball launches and collides with the target ball but does not stop. Any suggestions?
Coding a billiards game for a class project. My goal is to click the mouse once to place a cue ball, again to place a target ball, and then a third click will send the cue ball towards the target ball. When the cue ball collides with the target ball, the cue ball is supposed to stop and the target ball should start moving. I have code to check if they collide but right now I can't figure out how to test if it is working because the cue ball won't launch on the third mouse click. Any suggestions?
I'm making a Billiards game for a project for my university. Right now I have a class named Ball that I use for both my cueBall and targetBall objects. Right now I have the variables centerX1 and centerY1 for the cueBall object and centerX2 and centerY2 for the targetBall object. I want to set the place x and y coordinates of where the mouse clicks the first time to be the x and y of my cueBall object. I want the second click to set the x and y coordinates for my targetBall object. I think the problem may have something to do with the parameters I'm initializing the objects of cueBall and targetBall with in setup(). Any suggestions on improving my code are appreciated. :)
//////////////////////////////Beginning of Code////////////////////////////
//Code by D. Witt.
int ballPlaced = 0;
float centerX1, centerY1, centerX2, centerY2;
float rise, run;
boolean isLaunched;
Ball cueBall, targetBall;
float currentDist;
void setup()
{
size(800, 400);
background(0,100,0);
rise = 0;
run = 0;
cueBall = new Ball(centerX1, centerY1, color(255,255,255));
targetBall = new Ball(centerX2, centerY2, color(255,255,0));
I'm working on a project for one of the classes at my university and I'm getting an error that the constructor for the Ball class is undefined. I thought the way I set it up was correct and I'm not exactly sure what I'm doing wrong with the constructor. Your advice on fixing it is appreciated. :)
///////Beginning of code////////
//Billiard
//by D. Witt
int ballPlaced = 0;
float centerX1, centerY1, centerX2, centerY2;
float rise, run;
boolean isLaunched;
Ball cueBall, targetBall;
float currentDist;
void setup()
{
size(800, 400);
background(0,100,0);
rise = 0;
run = 0;
cueBall = new Ball(centerX1, centerY1, color(255,255,255));
targetBall = new Ball(centerX2, centerY2, color(255,255,0));