Hey, I am making a simple survival game like, for example, Robot Unicorn Attack but without the fancy graphics. Well actually... your just a ball and you have to dodge balls and squares. Well, I had just started messing around with inheritance and I am trying to setup collision detection and it seems to be going well, just that the ball that's supposed to follow your mouse doesn't want to show anymore. I've been messing around with it, trying to get it to show, for about a day now with no sign of success. I would appreciate all the help I could get. Without posting all the code as it is getting pretty lengthy, I think I have gotten down to the area where it doesn't show. I'll post the snippet of code and if you need more, I will gladly supply it.
(I think this is where it goes wrong...)
Thanks in advance,
TheGamersHaven
(I think this is where it goes wrong...)
- Ball playerBall;
- void setup() {
- size(300,300);
- background(255);
- playerBall = new Ball(mouseX,mouseY,10,10);
- }
- void draw() {
- playerBall.display();
- playerBall.xpos = mouseX;
- playerBall.ypos = mouseY;
- }
- class Entity {
- float xpos, ypos, sWidth, sHeight;
- }
- class Ball extends Entity {
- Ball(float tempX, float tempY, float tempWidth, float tempHeight) {
- this.xpos = tempX;
- this.ypos = tempY;
- this.sWidth = tempWidth;
- this.sHeight = tempHeight;
- }
- void display() {
- ellipseMode(CENTER);
- fill(100,0,0);
- }
- }
Thanks in advance,
TheGamersHaven
1