File: ef230-2023-08/www/examples/mario2.m Download
%% EF 230 Plotting Picture
%claborde_ef230


%% Attempted Super Mario
%Here goes nothin'
function main
clear all; close all; clc

%% Axis
x=[0:20];
y=[0];
plot(x,y,'gr-');
axis ([0 20 0 20]);

%% Hat
c = 'r';
p = [7,17,5,1     % upper hat
    6,16,9,1];    % lower hat
rec(p,c)    

%% Hair
c = [0.7 0.4 0];
p = [6,15,3,1   % hair 1
     7,13,1,2   % hair 2
     5,12,1,3   % hair 3
     6,12,1,1   % hair 4
     8,13,1,1]; % hair 5
rec(p,c)    

%% Eye
c = [0.7 0.4 0];
rec([11,14,1,2],c) % eye

%% Suspenders
c = 'b';
rec([8,8,1,3],c)  % left suspender
rec([9,5,2,4],c)  % middle suspender
rec([7,4,2,3],c)  % left leg 1
rec([6,4,1,2],c)  % left leg 2
rec([7,7,1,1],c)  % left leg 3
rec([11,4,2,3],c) % right leg 1
rec([13,4,1,2],c) % right leg 2
rec([12,7,1,1],c) % right leg 3
rec([11,8,1,2],c) % right suspender

%% Mustache
c = [0.7 0.4 0];
rec([12,13,1,1],c)  % mustache 1
rec([11,12,4,1],c)  % mustache 2

%% Buttons
c = 'y';
rec([8,7,1,1],c)  % left button
rec([11,7,1,1],c) % right button

%% Face
c = [1 .8 0];
rec([6,13,1,2],c)  % ear
rec([9,11,2,5],c)  % face 1
rec([7,11,2,2],c)  % face 2
rec([11,11,3,1],c) % face 3
rec([8,14,1,1],c)  % face 4
rec([11,13,1,1],c) % face 5
rec([12,14,1,2],c) % nose 1
rec([13,13,2,2],c) % nose 2
rec([15,13,1,1],c) % nose 3

%% Boots
c = [0.7 .4 0];
rec([12,2,3,2],c)  % right boot 1
rec([15,2,1,1],c)  % right boot 2
rec([5,2,3,2],c)   % left boot 1
rec([4,2,1,1],c)   % left boot 2

%% Arms and Torso
c = 'r';
rec([6,8,2,3],c)   % left arm 1
rec([5,8,1,2],c)   % left arm 2
rec([4,8,1,1],c)   % left arm 3
rec([6,7,1,1],c)   % left arm 4
rec([9,9,2,2],c)   % chest 1
rec([11,10,1,1],c) % chest 2
rec([12,8,3,2],c)  % right arm 1
rec([15,8,1,1],c)  % right arm 2
rec([13,7,1,1],c)  % right arm 3

%% Hands
c = [1 .8 0];
rec([14,5,2,3],c)  % right hand 1
rec([13,6,1,1],c)  % right hand 2
rec([4,5,2,3],c)   % left hand 1
rec([6,6,1,1],c)   % left hand 2

%% Text
text(4.5,.01,'Itsa me, Mario!','fontname','times','fontsize',40,'fontangle','italic')

%% Background
axis off
whitebg([1 1 1])

%% Goomba

function rec(plist,c)
 n = size(plist,1);
 for i=1:n
     p = plist(i,:);
    rectangle('Position',p,'facecolor',c,'edgecolor',c);
 end
return