Download presentation
Presentation is loading. Please wait.
1
Make Tetris Using Java By bearzx
2
What is Tetris A simple but interesting game
3
Java Graphic Programming
Just using Graphics Class Draw anything you want in a Java GUI Gomponent(Jpanel, Jframe, etc)
4
Key Points Of Tetris Game
How to store a shape ? How to generate a shape ? What happens after a shape is generated ? How to describe a ground ? How to accept a shape, and DELETE full lines ? Let’ s fix them one by one
5
How to store a shape ? Just using an array with 3 dimensions
6
How to generate a shape ? When we need a new shape, we “new” a instance of Shape Class
7
What happens after a shape is generated ?
Make it falls down, using Java multithreading feature. Define a class which implements Runnable interface
8
How to describe a ground ?
Like a shape, use a 2 dimensions array for a ground, it is just bigger When you need to draw the ground, just have a look at the obstacles.
9
How to accept a shape, and DELETE full lines ?
First you need to decide whether or not the shape can move down
10
How to accept a shape, and DELETE full lines ?
If the shape can’ t move down, accept it. And don’ t remember to delete the full lines, if you can
11
Let’ s Link Them Up Int [][] body Shape Driver drawMe() Shape
moveDown() moveLeft() rotate … Shape GamePanel Controller int [][] obstacles isMoveable accept() drawMe() deleteLines() newGame() keyPressed() pause() stop() … Ground
12
Nope, it just have lots of details
Is This Hard ? Nope, it just have lots of details all you need to do is install your Java Virtual Machine set up your Java IDE then start coding If you need to view the complete code, welcome to fork it on GitHub
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.