• Remix
  • Share
  • New Entry

on 23 Oct 2024
  • 18
  • 144
  • 0
  • 1
  • 1440
Cite your audio source here (if applicable): Original soundtrack from the 1986 arcade game, produced by Taito, composed by Martin Galway.
drawframe(1)
function drawframe(f)
persistent game bricks base ball_x ball_y ball_dx ball_dy
if isempty(bricks)
bricks=zeros(8,16);
bricks([41:43,47,49:51,55,57,63,65,71,73:75,77:79,81:83,85:87,91:2:95,99:2:103,105:107,109,111,113:115,117,119])=floor([1:1.5:60]);
[base,ball_x,ball_y,ball_dx,ball_dy,game]=deal(8,8,1,1,1,true);
end
next_x=ball_x+ball_dx;
next_y=ball_y+ball_dy;
bounced=false;
if next_x<1 || next_x>16
ball_dx=-ball_dx;
bounced=true;
elseif bricks(ceil(next_x/2),ball_y)>0
ball_dx=-ball_dx;
bounced=true;
bricks(ceil(next_x/2),ball_y)=0;
end
if next_y<2 && (base<ball_x-2 || base>ball_x)
game=false;
elseif next_y<2 || next_y>16
ball_dy=-ball_dy;
bounced=true;
elseif bricks(ceil(ball_x/2),next_y)>0
ball_dy=-ball_dy;
bounced=true;
bricks(ceil(ball_x/2),next_y)=0;
end
if ~bounced && bricks(ceil(next_x/2),next_y)>0
ball_dx=-ball_dx;
ball_dy=-ball_dy;
bricks(ceil(next_x/2),next_y)=0;
end
ball_x=ball_x+ball_dx;
ball_y=ball_y+ball_dy;
if f<92
base=min(14,max(1,ball_x-1)); % player bot: follow the ball, miss it at the end
end
cla;
axis([0 16 0 16]);
axis equal
axis off
map=hsv;
rectangle('Position',[0,0,16,16],'EdgeColor',[0.5,0.5,0.5],'linewidth',3); % frame
for x=1:8
for y=1:16
b=bricks(x,y);
if b
rectangle('Position',[2*x-1.8,y-1,1.8,0.8],'EdgeColor','#D0D0D0','FaceColor','#D0D0D0'); % shadow
rectangle('Position',[2*x-1.9,y-0.9,1.8,0.8],'EdgeColor',map(b,:),'FaceColor',map(b,:)); % piece
end
end
end
rectangle('Position',[ball_x-1,ball_y-1,1,1],'Curvature',[1,1],'EdgeColor','#606060','FaceColor','#606060'); % ball
rectangle('Position',[base-0.9,0.2,2.8,0.8],'Curvature',[0.2,0.2],'EdgeColor','b','FaceColor','b'); % base
end
Movie
Audio
Remix Tree