Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //brRickbrReaker
- //variables ladrillos
- int xB, yB; //posición ext sup izq pared ladrillos
- int wB, hB; //ancho / alto ladrillos
- int dx, dy; //espacio entre ladrillos
- int roB, coB; // rows / columns L
- int scR, scG; // score r/g
- PImage brR, brG; // ladrillos rojo / verde
- void setup(){
- size(900,600);
- wB = 80;
- hL = 30;
- dx = 1;
- dy = 1;
- brR = loadImage("brickR.png");
- brG = loadImage("brickG.png");
- roB = 5;
- coB = floor((width+2*dx)/wB); //'floor' redondea floats hacia el número menor
- //'ceil' redondea hacia arriba
- brRick[][] brickW; //array bidimensional que forma pared
- scR = 10;
- scG = 50;
- //inicializamos array que contiene pared de ladrillos
- brickW = new Brick[roB][coB];
- ini(){
- //creamos pared ladrillos
- }
- }
- // _______________________________class en otra pestaña
- //Tres clases: general/rectangulo, y raqueta + ladrillos que heredan propiedades gral
- class Rectangle{
- //propiedades
- int x, y, w, h;
- Rectangle (int x1, int y1, int w1, int h1){
- x = x1;
- y = y1;
- w = w1;
- h = h1;
- }
- }
- class Racket extends Rectangle{
- //extends pasa propiedades gral
- int vx;
- color c;
- Racket(int x, int y, int w, int h, int vx1, color c1){
- super(x, y, w, h); //pasamos propiedades de clase padre
- vx = vx1;
- c = c1;
- }
- void move(){
- x += vx;
- if (x <= 0) x = 0;
- if (x+w >= width)x=width;
- }
- }
- class Brick extends Rectangle{
- PImage icon;
- int score;
- boolean ex;
- Ladrillo(int x, int y, int w, int h, PImage icon1, int score1, boolean ex1){
- super(x, y, w, h);
- icon = icon1;
- score = score1;
- ex = ex1;
- }
- void show(){
- if (ex){
- image(icon,x,y);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement