final project

control to attack the boss or evade an attack by smart phone

attack five time and win the game

player only have 3HP

code:

clear all;

m = mobiledev;

swing=0;

pause(0.75)

w=0;

picture=0;

bh=5;

hp=3;

pic1=imread('hint.JPG');

image(pic1)

pause(1)

while swing==0

disp('start');

picture=round(10*rand(1,1))+1;

if picture==1

pic=imread('boss001.JPG');

elseif picture==2

pic=imread('boss002.JPG');

elseif picture==3

pic=imread('boss003.JPG');

elseif picture==4

pic=imread('boss004.JPG');

elseif picture==5

pic=imread('boss005.JPG');

elseif picture==6

pic=imread('boss006.JPG');

elseif picture==7

pic=imread('boss007.JPG');

elseif picture==8

pic=imread('boss008.JPG');

elseif picture==9

pic=imread('boss009.JPG');

elseif picture==10

pic=imread('boss010.JPG');

elseif picture==11

pic=imread('boss011.JPG');

end

image(pic)

pause(1.5)

m.Logging = 1;

pause(0.75);

m.Logging = 0;

[or, tor] = orientlog(m);

y = or(:,1);

h=y(end);

z = or(:,3);

v=z(end);

load_system('project');

sim('project');

hp=max(php);

p = max(pict);

bh=max(bhp);

if p==1

pic=imread('player001.JPG');

elseif p==2

pic=imread('player001.JPG');

elseif p==3

pic=imread('111.JPG');

image(pic)

pause(0.25)

pic=imread('222.JPG');

image(pic)

pause(0.25)

pic=imread('333.JPG');

image(pic)

pause(0.25)

pic=imread('444.JPG');

image(pic)

pause(0.25)

pic=imread('555.JPG');

elseif p==4

pic=imread('player001.JPG');

elseif p==5

pic=imread('111.JPG');

image(pic)

pause(0.25)

pic=imread('222.JPG');

image(pic)

pause(0.25)

pic=imread('333.JPG');

image(pic)

pause(0.25)

pic=imread('444.JPG');

image(pic)

pause(0.25)

pic=imread('555.JPG');

elseif p==6

pic=imread('player001.JPG');

elseif p==7

pic=imread('player001.JPG');

elseif p==8

pic=imread('111.JPG');

image(pic)

pause(0.25)

pic=imread('222.JPG');

image(pic)

pause(0.25)

pic=imread('333.JPG');

image(pic)

pause(0.25)

pic=imread('444.JPG');

image(pic)

pause(0.25)

pic=imread('555.JPG');

elseif p==9

pic=imread('player001.JPG');

elseif p==10

pic=imread('111.JPG');

image(pic)

pause(0.25)

pic=imread('222.JPG');

image(pic)

pause(0.25)

pic=imread('333.JPG');

image(pic)

pause(0.25)

pic=imread('444.JPG');

image(pic)

pause(0.25)

pic=imread('555.JPG');

elseif p==11

pic=imread('111.JPG');

image(pic)

pause(0.25)

pic=imread('222.JPG');

image(pic)

pause(0.25)

pic=imread('333.JPG');

image(pic)

pause(0.25)

pic=imread('444.JPG');

image(pic)

pause(0.25)

pic=imread('555.JPG');

elseif p==12

pic=imread('drink.JPG');

elseif p==15

pic=imread('lose.JPG');

swing=1;

elseif p==14

pic=imread('player002.JPG');

end

if bh==0

pic=imread('win.JPG');

swing=1;

end

pause(0.25)

image(pic)

pause(1)

end

stateflow: