Entradas

Mostrando las entradas de agosto, 2014

MiniPong

Imagen
Simple juego de pong, gana el que llega a 5 primero. MiniPong.java package com.dansan.minipong; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; /** * * @author Programador */ public class MiniPong extends JPanel{ static final int ancho = 800; static final int alto = 600; int speed=1; Pelota pelota = new Pelota(this); Raqueta1 raqueta1 = new Raqueta1(0, 0, this); Raqueta2 raqueta2 = new Raqueta2(ancho-35, alto-200, this); public MiniPong(){ addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { raqueta1.keyPressed(e); raqueta2.keyPressed(e);