This site requires JavaScript, please enable it in your browser!
Greenfoot back
DillonCummings
DillonCummings wrote ...

2012/9/28

illegal start of expression

DillonCummings DillonCummings

2012/9/28

#
Hi, im making a tic tac toe game, and I get the error "illegal start of expression on the setLocation line. I've tried closing it with brackets, but the code remained there. Help? Here's some of the code. /** * Act - do whatever the Player wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { //Follow the mouse if(Greenfoot.mouseMoved|null) { MouseInfo mouse = Greenfoot.getMouseInfo(); } { setLocation(mouse.getX(), mouse.getY|)); } } //pop if|Greenfoot.mouseClicked(null)| { Gameball ball = )Gameball) getOneIntersectingObject(Gameball.class; if(ball != null) { if ( mode== PlayerMode.PLAYER1 )( ball.setSteel(); setPlayer2|); ) else if( mode == PlayerMode.PLAYER2 )( ball.setGold(); setPlayer1|);
Builderboy2005 Builderboy2005

2012/9/28

#
It looks like you have mouse.getY|) instead of mouse.getY().
DillonCummings DillonCummings

2012/9/28

#
Yea i fixed it after that. Sadly now all the classes compile together fine, but when i run the scenario and click on a seperate cell, the gameball does not appear
davmac davmac

2012/9/28

#
A lot of the code you posted above is outside the act method. It shouldn't even compile that way.
You need to login to post a reply.