This file contains hidden or 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
public class Cords | |
{ | |
public static enum Dir {UP, DOWN, LEFT, RIGHT, STOP} | |
public static Dir dir; | |
protected double x, y, size; | |
public double getX(){return x;} | |
public double getY(){return y;} | |
public double getCenterX(){return x+size/2;} | |
public double getCenterY(){return y+size/2;} | |
public void increaseX(double num){x+=num;} |
This file contains hidden or 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
public class Stat | |
{ | |
private double cur = 0; | |
private double max = 0; | |
public Stat(int max) | |
{ | |
this.max = max; | |
cur = max; | |
} | |
public void add(double num) |
This file contains hidden or 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
import java.awt.Canvas; | |
import java.awt.Color; | |
import java.awt.Dimension; | |
import java.awt.Graphics; | |
import java.awt.Rectangle; | |
import java.awt.event.KeyEvent; | |
import java.awt.event.KeyListener; | |
import java.awt.image.BufferStrategy; | |
import javax.swing.JFrame; |
This file contains hidden or 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
import java.awt.Canvas; | |
import java.awt.Color; | |
import java.awt.Dimension; | |
import java.awt.Graphics; | |
import java.awt.Rectangle; | |
import java.awt.event.KeyEvent; | |
import java.awt.event.KeyListener; | |
import java.awt.image.BufferStrategy; | |
import java.util.Random; | |
import javax.swing.JFrame; |
This file contains hidden or 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
public class Game extends Canvas implements Runnable | |
{ | |
static Thread t; | |
public int width = 500, height = 300, playerSize = 10; | |
public InputHandler input; | |
public Player player = new Player(); | |
public Box box = new Box(); | |
public static void main(String args[]) | |
{ | |
JFrame frame = new JFrame(); |
This file contains hidden or 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
import java.awt.Canvas; | |
import java.awt.Color; | |
import java.awt.Dimension; | |
import java.awt.Graphics; | |
import java.awt.Rectangle; | |
import java.awt.event.KeyEvent; | |
import java.awt.event.KeyListener; | |
import java.awt.image.BufferStrategy; |
This file contains hidden or 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
import java.awt.Color; | |
import java.awt.Dimension; | |
import java.awt.Font; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.text.DecimalFormat; | |
import javax.sound.sampled.AudioInputStream; | |
import javax.sound.sampled.AudioSystem; | |
import javax.sound.sampled.Clip; |
This file contains hidden or 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
import java.awt.Color; | |
import java.awt.Dimension; | |
import java.awt.Font; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.text.DecimalFormat; | |
import javax.swing.JButton; | |
import javax.swing.JFrame; | |
import javax.swing.JLabel; |
This file contains hidden or 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
import javax.swing.JOptionPane; | |
/* | |
///-_-_- JOPTIONPANE TUTORIAL -_-_-\\\ | |
Hello this is my very first programming tutorial, what is up, this is a tutorial on how to use JOptionPane! | |
up to now you have been using System.out.print() to output messages & you've been using java.util.Scanner | |
to receive input but now I'll tell you how to use JOptionPane's showMessageDialog() & showInputDialog() methods. | |
JOptionPane programs are little pop up windows that either have a dialog box that has a message and asks for input that is | |
the showInputDialog() the other is showMessageDialog, it is just a little message with a Icon if you want, both pop up window | |
types can have a title & both need to have null for the container usually like probably too early for you for me to talk about that. | |
JOptionPane Programs are a lot more easy to use and to work with than the console type programs you have made so far, |