Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. //brRickbrReaker
  2.  
  3. //variables ladrillos
  4. int xB, yB; //posición ext sup izq pared ladrillos
  5. int wB, hB; //ancho / alto ladrillos
  6. int dx, dy; //espacio entre ladrillos
  7. int roB, coB; // rows / columns L
  8. int scR, scG; // score r/g
  9. PImage brR, brG; // ladrillos rojo / verde
  10.  
  11. void setup(){
  12. size(900,600);
  13. wB = 80;
  14. hL = 30;
  15. dx = 1;
  16. dy = 1;
  17. brR = loadImage("brickR.png");
  18. brG = loadImage("brickG.png");
  19. roB = 5;
  20. coB = floor((width+2*dx)/wB); //'floor' redondea floats hacia el número menor
  21. //'ceil' redondea hacia arriba
  22.  
  23. brRick[][] brickW; //array bidimensional que forma pared
  24. scR = 10;
  25. scG = 50;
  26.  
  27. //inicializamos array que contiene pared de ladrillos
  28. brickW = new Brick[roB][coB];
  29.  
  30. ini(){
  31. //creamos pared ladrillos
  32.  
  33. }
  34. }
  35.  
  36.  
  37. // _______________________________class en otra pestaña
  38.  
  39. //Tres clases: general/rectangulo, y raqueta + ladrillos que heredan propiedades gral
  40.  
  41. class Rectangle{
  42. //propiedades
  43. int x, y, w, h;
  44.  
  45. Rectangle (int x1, int y1, int w1, int h1){
  46. x = x1;
  47. y = y1;
  48. w = w1;
  49. h = h1;
  50. }
  51. }
  52.  
  53. class Racket extends Rectangle{
  54. //extends pasa propiedades gral
  55. int vx;
  56. color c;
  57.  
  58. Racket(int x, int y, int w, int h, int vx1, color c1){
  59. super(x, y, w, h); //pasamos propiedades de clase padre
  60. vx = vx1;
  61. c = c1;
  62. }
  63.  
  64. void move(){
  65. x += vx;
  66.  
  67. if (x <= 0) x = 0;
  68. if (x+w >= width)x=width;
  69. }
  70.  
  71. }
  72.  
  73. class Brick extends Rectangle{
  74. PImage icon;
  75. int score;
  76. boolean ex;
  77.  
  78. Ladrillo(int x, int y, int w, int h, PImage icon1, int score1, boolean ex1){
  79. super(x, y, w, h);
  80. icon = icon1;
  81. score = score1;
  82. ex = ex1;
  83. }
  84.  
  85. void show(){
  86. if (ex){
  87. image(icon,x,y);
  88.  
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement