function varargout = r06522634(varargin)
% R06522634 MATLAB code for r06522634.fig
% R06522634, by itself, creates a new R06522634 or raises the existing
% singleton*.
%
% H = R06522634 returns the handle to a new R06522634 or the handle to
% the existing singleton*.
%
% R06522634('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in R06522634.M with the given input arguments.
%
% R06522634('Property','Value',...) creates a new R06522634 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before r06522634_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to r06522634_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help r06522634
% Last Modified by GUIDE v2.5 06-Jan-2018 23:48:36
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @r06522634_OpeningFcn, ...
'gui_OutputFcn', @r06522634_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before r06522634 is made visible.
function r06522634_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to r06522634 (see VARARGIN)
% Choose default command line output for r06522634
set(gcf,'name','柯p跑起來!!')
handles.output = hObject;
handles.ht=timer;
set(handles.ht,'ExecutionMode','FixedRate');
set(handles.ht,'Period',0.1);
set(handles.ht,'TimerFcn',{@dispNow,handles});
start(handles.ht);
global key I0 I1 I2 I3 I4 I5 I6 I7 f1 Fs1 f2 Fs2 f3 Fs3
[f1,Fs1] = audioread('金幣.mp3');
[f2,Fs2] = audioread('死去.mp3');
[f3,Fs3] = audioread('破牆.mp3');
key=0;
I0 = imread('0.png');
I0=imresize(I0,[50,50]);
I1 = imread('1.jpg');
I1=imresize(I1,[50,50]);
I2 = imread('2.jpg');
I2=imresize(I2,[50,50]);
I3 = imread('3.png');
I3=imresize(I3,[50,50]);
I4 = imread('4.png');
I4=imresize(I4,[50,50]);
I5 = imread('5.png');
I5=imresize(I5,[50,50]);
I6 = imread('6.jpg');
I6=imresize(I6,[50,50]);
I7 = imread('7.jpg');
global clock x y round speed score item
global life I gamestart
score = 0;
speed = 0;
clock = 4;
round = 0;
I=zeros(8,5);
I(4,:)=2;
I(6,:)=2;
I(8,:)=2;
I(4,3)=0;
I(6,4)=0;
I(8,2)=0;
x=1;
y=3;
I(x,y)=4;
life=1;
gamestart=0;
item = 0;
for i=1:8
for j=1:5
if I(i,j)==4
II{i,j}=I4;
elseif I(i,j)==5
II{i,j}=I5;
elseif I(i,j)==2
II{i,j}=I2;
else
II{i,j}=I0;
end
end
end
III = cell2mat(II);
axes(handles.axes1);
imshow(I7);
set(handles.text5, 'String', item);
set(handles.text6, 'String', score);
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes r06522634 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = r06522634_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
function figure1_WindowKeyPressFcn(hObject, eventdata, handles)
% hObject handle to figure1 (see GCBO)
% eventdata structure with the following fields (see FIGURE)
% Key: name of the key that was pressed, in lower case
% Character: character interpretation of the key(s) that was pressed
% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles structure with handles and user data (see GUIDATA)
global key
switch eventdata.Key
case 'rightarrow'
key=1;
case 'leftarrow'
key=2;
case 'shift'
key=3;
end
function dispNow(~,~,handles)
global key I0 I1 I2 I3 I4 I5 I6 f1 Fs1 f2 Fs2 f3 Fs3
global clock x y a round coin coinpos speed score item
global life I gamestart music
set(handles.text1,'string',datestr(now));
if gamestart == 1
if life == 1
switch key
case 1
if y>0 && y<5
if I(x,y+1) == 0
I(x,y) = 0;
y = y + 1;
I(x,y) = 4;
elseif I(x,y+1) == 3
I(x,y) = 0;
y = y + 1;
I(x,y) = 4;
score = score + 250 ;
sound(f1,Fs1);
elseif I(x,y+1) == 6
I(x,y) = 0;
y = y + 1;
I(x,y) = 4;
item = item +1;
sound(f1,Fs1);
elseif I(x,y+1) == 2
I(x,y) = 0;
y = y + 1;
I(x,y) = 1;
life = 0;
stop(music);
sound(f2,Fs2);
msgbox(['柯p自殺爽嗎... 得分為' num2str(score)]);
end
end
case 2
if y>1 && y<6
if I(x,y-1) == 0
I(x,y) = 0;
y = y-1;
I(x,y) = 5;
elseif I(x,y-1) == 3
I(x,y) = 0;
y = y-1;
I(x,y) = 5;
score = score + 250 ;
sound(f1,Fs1);
elseif I(x,y-1) == 6
I(x,y) = 0;
y = y-1;
I(x,y) = 5;
item = item +1;
sound(f1,Fs1);
elseif I(x,y-1) == 2
I(x,y) = 0;
y = y-1;
I(x,y) = 1;
life = 0;
stop(music);
sound(f2,Fs2);
msgbox(['柯p自殺爽嗎... 得分為' num2str(score)]);
end
end
case 3
if item > 0
if I(x+1,y) == 2
I(x+1,y) = 0;
item = item -1;
end
end
sound(f3,Fs3);
end
key = 0;
clock = clock-0.1;
if clock < 0.05
if round == 0
for i=2:8
for j=1:5
if I(i-1,j) ~= 4 && I(i-1,j) ~= 5
I(i-1,j)=I(i,j);
elseif I(i,j) == 2 && (I(i-1,j) == 4 || I(i-1,j) ==5)
I(i-1,j) = 1;
life = 0;
stop(music);
sound(f2,Fs2);
msgbox(['柯p施政你都搞到牆上了阿..得分為' num2str(score)]);
end
end
end
clock = 2.0-speed;
coin = randi([1 7],1);
if coin < 4
I(8,:)=0;
elseif coin > 4
coinpos = randi([1 5],1);
I(8,:)=0;
I(8,coinpos)=3;
elseif coin == 4
coinpos = randi([1 5],1);
I(8,:)=0;
I(8,coinpos)=6;
end
round = 1;
if s
Matlab+图像音乐综合处理+大学数学建模适用
需积分: 10 63 浏览量
2022-11-04
23:44:58
上传
评论
收藏 7.64MB RAR 举报
BinaryStarXin
- 粉丝: 8090
- 资源: 287
最新资源
- 基于Typescript的兔子饭店经营类游戏源码设计免费送cocoscreator
- 基于Java的web快速开发数据权限管理脚手架wonder-server设计源码
- 基于Apache Log4cxx的C++日志库设计源码
- 基于Vue3的likeadmin免费任意商用管理后台设计源码
- 基于JavaScript的Chrome扩展WeNote分享插件设计源码
- 基于C++的中泰EM9108S动态库开发示例源码
- gxlx2-p291-1g.dts和gxlx2-p291-1g.dtb
- STM32WBxx Keil芯片包
- 基于CNN+Bi-LSTM+Attention 的自动对对联系统
- 基于Java的IndexBar Android字母索引栏设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈