You are using an unsupported browser. Please update your browser to the latest version on or before July 31, 2020.
close
You are viewing the article in preview mode. It is not live at the moment.
Emails from our Customer Support team will be sent from [email protected].

To ensure you receive important updates without interruption, please add [email protected] to your safe sender list and mark it as “not spam.”

Ludo Java Game 240x320 -

class LudoCanvas extends Canvas // Board array: 15x15 cells, 4 colors // Token positions, dice value, turn logic protected void paint(Graphics g) g.setColor(0xFFFFFF); g.fillRect(0, 0, getWidth(), getHeight()); drawBoard(g); drawTokens(g); drawDice(g);

public LudoGame() gameCanvas = new LudoCanvas(); exitCmd = new Command("Exit", Command.EXIT, 1); menuCmd = new Command("Menu", Command.SCREEN, 2); gameCanvas.addCommand(exitCmd); gameCanvas.addCommand(menuCmd); gameCanvas.setCommandListener(this); Ludo Java Game 240x320

public void startApp() display = Display.getDisplay(this); display.setCurrent(gameCanvas); class LudoCanvas extends Canvas // Board array: 15x15

protected void keyPressed(int keyCode) int action = getGameAction(keyCode); if (action == FIRE) rollDiceOrMoveToken(); // handle navigation 4 colors // Token positions

public void commandAction(Command c, Displayable d) if (c == exitCmd) notifyDestroyed(); else if (c == menuCmd) /* show options */

Feedback
3 out of 7 found this helpful

scroll to top icon