Make Tetris Using Java By bearzx.

Slides:



Advertisements
Similar presentations
24-Aug-14 Abstract Classes and Interfaces. Java is “safer” than Python Python is very dynamic—classes and methods can be added, modified, and deleted.
Advertisements

Lecture 3 A First Graphic Program. Features of a simple graphic program.
HOW TO: Completely Remove Windows 8 & Install Windows 7 HAS WINDOWS 8 GOT YOU DOWN? IT'S NOT EASY, BUT YOU CAN SWITCH YOUR NEW PC BACK TO WINDOWS 7. WE.
Picture It Very Basic Game Picture Pepper. Original Game import java.util.Scanner; public class Game { public static void main() { Scanner scan=new Scanner(System.in);
Mouse Listeners We continue our examination of GUIs by looking at how to interact with the mouse –Just as Java creates Events when the user interacts with.
13/04/2015Client-server Programming1 Block 6: Threads 1 Jin Sa.
SUMMARY: abstract classes and interfaces 1 Make a class abstract so instances of it cannot be created. Make a method abstract so it must be overridden.
Microsoft® Small Basic
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Interface COMP T1.
. Virtual Classes & Polymorphism. Example (revisited) u We want to implement a graphics system u We plan to have lists of shape. Each shape should be.
Priority Queues and Heaps. Overview Our last ADT: PriorityQueueADT A new data structure: heaps One more sorting algorithm: heapsort Priority Queues and.
Polymorphism From now on we will use g++!. Example (revisited) Goal: Graphics package Handle drawing of different shapes Maintain list of shapes.
Concurrency and Thread Yoshi. Two Ways to Create Thread Extending class Thread – Actually, we need to override the run method in class Thread Implementing.
Java Threads Part I. Lecture Objectives To understand the concepts of multithreading in Java To be able to develop simple multithreaded applications in.
Java Threads Part II. Lecture Objectives To understand the concepts of multithreading in Java To be able to develop simple multithreaded applications.
Objects and Classes First Programming Concepts. 14/10/2004Lecture 1a: Introduction 2 Fundamental Concepts object class method parameter data type.
Slides prepared by Rose Williams, Binghamton University Chapter 20 Java Never Ends.
Slides prepared by Rose Williams, Binghamton University ICS201 Lectures 18 : Threads King Fahd University of Petroleum & Minerals College of Computer Science.
Course Map The Java Programming Language Basics Object-Oriented Programming Exception Handling Graphical User Interfaces and Applets Multithreading Communications.
CSE 115 Week 6 February , Announcements Software Installation Fest – Take 2 Software Installation Fest – Take 2 –Tuesday 2/ –Wednesday.
Lesson One: The Beginning
Honors 101, Fall 2006 Please do not sit in back of room! Lots of info on web page Join the mailing list Download Eclipse and start using it Read the text.
Introduction to Java Programming Language Junji Zhi University of Toronto 1.
SE320: Introduction to Computer Games Week 8: Game Programming Gazihan Alankus.
M1G Introduction to Programming 2 4. Enhancing a class:Room.
ACM/JETT Workshop - August 4-5, ExceptionHandling and User Interfaces (Event Delegation, Inner classes) using Swing.
Computer Hardware and Software Chapter 1. Overview Brief History of Computers Hardware of a Computer Binary and Hexadecimal Numbers Compiling vs. Interpreting.
Introduction to Programming with Java. Overview What are the tools we are using – What is Java? This is the language that you use to write your program.
Event Driven Programming
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Visual Linker Final presentation.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
REVIEW On Friday we explored Client-Server Applications with Sockets. Servers must create a ServerSocket object on a specific Port #. They then can wait.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
POS 406 Java Technology And Beginning Java Code
How to Create a Videogame By: Connor McCann. Java Java is one of many programming languages Java is used to run web browsers and most PC video games I.
Recommendation: Play the game and attempt to answer the questions yourself without looking at the answers. You’ll learn much less if you just look at the.
Hash Tables.
Inheritance (Part 4) Abstract Classes 1.  sometimes you will find that you want the API for a base class to have a method that the base class cannot.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
Project 1: Animation System Assigned: 01/17/06 Due: 01/31/06.
CS 106 Introduction to Computer Science I 04 / 25 / 2008 Instructor: Michael Eckmann.
API Crash Course CWU Startup Club. OUTLINE What is an API? Why are API’s useful? What is HTTP? JSON? XML? What is a RESTful API? How do we consume an.
Concurrent Computing CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
M1G Introduction to Programming 2 5. Completing the program.
Lesson 3: Arrays and Loops. Arrays Arrays are like collections of variables Picture mailboxes all lined up in a row, or storage holes in a shelf – You.
Recitation 7 Collections. Array List and Linked List Array List and Linked List are implementations of the same interface: List. As a result, they have.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
Week 8 - Friday.  What did we talk about last time?  Static methods.
Catie Welsh March 23,  Lab 6 due Friday by 1pm 2.
Lecture 33: More Graphical User Interface (GUI) Announcements & Review Read Ch GU1 & GU2 Cohoon & Davidson Ch 14 Reges & Stepp Lab 10 set game due 4/26.
COMP 110 Designing and overloading methods Luv Kohli November 3, 2008 MWF 2-2:50 pm Sitterson 014.
Final Projects Lecture 22. Common Mistakes (1/3) The location of a shape in an array/ ArrayList does not directly impact the graphical location of the.
Slides prepared by Rose Williams, Binghamton University Chapter 20 Java Never Ends.
Overview of Creational Patterns ©SoftMoore ConsultingSlide 1.
Frank Rowe John Gaetano Chuck Figiel.  CryptoViz implements and visualizes the Data Encryption Standard (DES) algorithm.  DES was used by the government.
Programming Objectives What is a programming language? Difference between source code and machine code What is python? – Where to get it from – How to.
Java Thread Programming
Project Overview Introduction Clawbot Build Design Modification
Interface Java 7 COMP T1.
Java Applets.
Project Overview Introduction Clawbot Build Design Modification
Stacks.
GUI AND GRAPHICS.
Chapter 19 Java Never Ends
Miscellaneous Topics #6: Polygons GUI Components and Event Handlers
Lesson 2: Building Blocks of Programming
A simple example of program design
Java Applets.
Presentation transcript:

Make Tetris Using Java By bearzx

What is Tetris A simple but interesting game

Java Graphic Programming Just using Graphics Class Draw anything you want in a Java GUI Gomponent(Jpanel, Jframe, etc)

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

How to store a shape ? Just using an array with 3 dimensions

How to generate a shape ? When we need a new shape, we “new” a instance of Shape Class

What happens after a shape is generated ? Make it falls down, using Java multithreading feature. Define a class which implements Runnable interface

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.

How to accept a shape, and DELETE full lines ? First you need to decide whether or not the shape can move down

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

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

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 https://github.com/bearzx/MyTetris