-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
622cc4d
commit 0dc8e3b
Showing
5 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package games.ludo; | ||
|
||
public class LudoGame { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package games.snake; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
|
||
public class GameFrame extends JFrame { | ||
|
||
public GameFrame() throws HeadlessException { | ||
this.add(new GamePanel()); | ||
this.setTitle("SNAKE"); | ||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | ||
this.setResizable(false); | ||
this.pack(); | ||
this.setVisible(true); | ||
this.setLocationRelativeTo(null); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package games.snake; | ||
|
||
import javax.swing.*; | ||
|
||
import java.awt.Graphics; | ||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
import java.awt.event.KeyAdapter; | ||
import java.awt.event.KeyEvent; | ||
|
||
public class GamePanel extends JPanel implements ActionListener { | ||
|
||
private static final int SCREEN_WIDTH = 600; | ||
private static final int SCREEN_HEIGHT = 600; | ||
private static final int UNIT_SIZE = 25; | ||
private static final int GAME_UNITS = (SCREEN_WIDTH * SCREEN_HEIGHT) / UNIT_SIZE; | ||
private static final int DELAY = 75; | ||
|
||
public GamePanel() {} | ||
|
||
// Starts game | ||
public void startGame(){ | ||
|
||
} | ||
|
||
// paint the component | ||
public void paintComponent(Graphics graphics){ | ||
|
||
} | ||
|
||
// Draw on the screen | ||
public void draw(Graphics graphics){ | ||
|
||
} | ||
|
||
// Move the snake | ||
public void move(){ | ||
|
||
} | ||
// Eat the apple | ||
public void checkApple(){ | ||
|
||
} | ||
|
||
// Check for collisions | ||
public void checkCollisions(){ | ||
|
||
} | ||
// Game over | ||
public void gameOver(Graphics graphics){ | ||
|
||
} | ||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
|
||
} | ||
|
||
public class MyKeyAdapter extends KeyAdapter{ | ||
|
||
@Override | ||
public void keyPressed(KeyEvent e) { | ||
super.keyPressed(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package games.snake; | ||
|
||
public class SnakeGame { | ||
|
||
public static void main(String[] args) { | ||
|
||
new GameFrame(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package games.tictactoe; | ||
|
||
public class TicTacToe { | ||
} |