• 大小: 40KB
    文件类型: .zip
    金币: 2
    下载: 0 次
    发布日期: 2023-12-29
  • 语言: Matlab
  • 标签: matlab  游戏  大富翁  

资源简介

通过matlab实现了大富翁买地升级地产收过路费操作,并且支持更改昵称及换头像,详见博文,对部分内容进行了纠正

资源截图

代码片段和文件信息

function [selfowenerListaliveList]=action_exchange(selfselfTooldiceTooloriPosnewPosnumNumblockDataowenerListaliveListnameList)
type=[1200 1000 1300 1400 1400 1600 0 0;
      1000 1000 1000 1200 1000 1400 0 0;
      2000 1500 1000 1600 1000 1800 0 0];
Ty=0;
SetName=[];
if oriPos>newPos
    self.([‘player‘num2str(numNum)]).property=self.([‘player‘num2str(numNum)]).property+2000;
end
if size(blockData{newPos+16}1)==2
    tempCell=blockData{newPos+16};
    switch 1
        case strcmp(tempCell{2}‘三步‘)
            self.([‘player‘num2str(numNum)]).pos=self.([‘player‘num2str(numNum)]).pos+3;
            self.([‘player‘num2str(numNum)]).pos=mod(self.([‘player‘num2str(numNum)]).possize(blockData1));
            pause(0.2)
        case strcmp(tempCell{2}‘两步‘)
            self.([‘player‘num2str(numNum)]).pos=self.([‘player‘num2str(numNum)]).pos+2;
            self.([‘player‘num2str(numNum)]).pos=mod(self.([‘player‘num2str(numNum)]).possize(blockData1));
            pause(0.2)
        case strcmp(tempCell{1}‘森林‘)Ty=3;SetName=[tempCell{1}tempCell{2}];
        case strcmp(tempCell{1}‘世纪‘)Ty=2;SetName=[tempCell{1}tempCell{2}];
        case strcmp(tempCell{1}‘河海‘)Ty=3;SetName=[tempCell{1}tempCell{2}];
        case strcmp(tempCell{1}‘海底‘)Ty=2;SetName=[tempCell{1}tempCell{2}];
        case strcmp(tempCell{1}‘人民‘)Ty=3;SetName=[tempCell{1}tempCell{2}];
    end
else
    tempStr=blockData{newPos+16};
    switch 1
        case strcmp(tempStr‘收费站‘)Ty=1;SetName=[tempStr‘ ‘];
        case strcmp(tempStr‘长桥‘)  Ty=1;SetName=[tempStr‘  ‘];
    end
end
if Ty~=0
    tempPos=find(owenerList(:1)==newPos);
    switch 1
        case isempty(tempPos)
            selfTool.([‘player‘num2str(numNum)]).Ta2.Value=[SetName‘ B:‘num2str(type(Ty1))‘ T:‘num2str(type(Ty2))‘ #‘num2str(Ty)‘ 1‘];
        case (~isempty(tempPos))&&owenerList(tempPos2)==numNum 
            if type(Ty(owenerList(tempPos3)+1)*2)~=0
                selfTool.([‘player‘num2str(numNum)]).Ta2.Value=[SetName‘ B:‘num2str(type(Ty(owenerList(tempPos3)+1)*2-1))‘ T:‘num2str(type(Ty(owenerList(tempPos3)+1)*2))‘ #‘num2str(Ty)‘ ‘num2str(owenerList(tempPos3)+1)];
            else
                selfTool.([‘player‘num2str(numNum)]).Ta2.Value=‘‘;
            end
        case (~isempty(tempPos))&&owenerList(tempPos2)~=numNum
            selfTool.([‘player‘num2str(numNum)]).Ta2.Value=[‘#支付 ‘nameList{owenerList(tempPos2)}‘ 资金:‘num2str(type(TyowenerList(tempPos3)*2))‘#‘];
            self.([‘player‘num2str(numNum)]).property=self.([‘player‘num2str(numNum)]).property-type(TyowenerList(tempPos3)*2);    
            self.([‘player‘num2str(owenerList(tempPos2))]).property=self.([‘player‘num2str(owenerList(tempPos2))]).property+type(TyowenerList(tempPos3)*2); 
            
    end
else
    selfTool.([‘player‘num2str(numNum)]).Ta2.Value=‘‘;
end


    if self.([‘player‘num2str(numNum)]).g

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-11-07 19:57  大富翁\
     文件        4218  2020-11-07 19:54  大富翁\action_exchange.m
     文件         296  2020-11-05 17:42  大富翁\block_draw.m
     文件        4394  2020-11-05 23:47  大富翁\block_load.m
     文件         548  2020-11-05 20:22  大富翁\dice_draw.m
     文件         186  2020-11-05 20:23  大富翁\dice_roll.m
     文件        4205  2020-11-08 20:09  大富翁\gui_init.m
     文件        8223  2020-11-10 15:16  大富翁\monopoly_main.m
     文件         703  2020-11-06 18:34  大富翁\self_draw.m
     文件         425  2020-11-08 14:19  大富翁\self_init.m
     文件         382  2020-11-07 19:41  大富翁\self_updata.m
     目录           0  2020-11-06 18:26  大富翁\图片\
     文件         738  2020-11-05 22:47  大富翁\图片\drawp.m
     文件         303  2020-11-06 16:55  大富翁\图片\drawpp.m
     文件        5134  2020-11-05 22:47  大富翁\图片\player0.png
     文件        7826  2020-11-06 16:54  大富翁\图片\player1.png
     文件        7946  2020-11-06 16:54  大富翁\图片\player2.png
     文件        8008  2020-11-06 16:55  大富翁\图片\player3.png
     文件        7997  2020-11-06 16:55  大富翁\图片\player4.png

评论

共有 条评论