Struggling with function drawing a rectangle in an array for battleships game
in
Programming Questions
•
1 year ago
Hey,
I am creating a battleships game at the moment and really struggling with one bit...
I need to draw the "ships" (just rect's atm) using an addShipAt function I will include the code I have as that probably makes more sense than my ramblings!
Main Battleships tab
- void mousePressed()
- {
- println((mouseX/50)+0+","+((mouseY/50)+0));
- int gridX = mouseX/50;
- int gridY = mouseY/50;
- myBoard.addShipAt(gridX,gridY,ships[currentShip]);
- currentShip++;
- }
Board Class
- public void addShipAt(int gridX, int gridY, Battleships.ships[currentShip]) {
- x = gridX;
- x = gridY;
- }
TRIPLE_DOT, found '['
Any help would be much appreciated!
Thanks
Will
1