In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Today, the editor will share with you how to use Matlab to make a simple Dragon Boat Mini Game with detailed content and clear logic. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article.
Effect picture:
Steps
1 create Axes and import pictures
Window creation:
Mainfig=figure ('units','pixels','position', [50 100 760400],... 'Numbertitle','off','menubar','none','resize','off',... 'name','dragonBoat'); axes (' parent',Mainfig,'position', [0 011],... 'XLim', [0760],... 'YLim', [0400],... 'NextPlot','add',... 'layer','bottom',... 'Visible','on',... 'YDir','reverse',... 'XTick', [],... 'YTick', [])
Picture Import:
[bkg_C,~,~] = imread ('river.png'); [boat_C,~,boat_Alp] = imread (' boat.png'); [stone_C,~,stone_Alp] = imread ('stone.png')
The picture material can be taken from here.
2 create a timer function to move the background
DrawBkgHdl=image ([0760], [0400], bkg_C); fps = 20game = timer ('ExecutionMode',' FixedRate', 'Period',1/fps,' TimerFcn', @ dragongame); start (game) function dragongame (~, ~) tactitmaker 6; modt=mod (tPJ 720); newBkg_C=tempBkg_C (: 1mm modtrize 684mm modtfield:) Set (DrawBkgHdl,'CData',newBkg_C) end
3 draw stones and move them
In fact, five stones change their positions back and forth, and when the position of a stone decreases to a negative number, the value is increased and redrawn.
StonePos= [600stonePos 870 [1140politics 1410]; stonePos= [stonePos,randi ([90330], [4meme 1])]; for i=1:size (stonePos,1) drawStoneHdl (I) = image ([stonePos (iMagne 1)-39 stonePos (iMagne 1) + 39], [stonePos (iMagazine 2)-20 stonePos (iMagne2) + 20], stone_C,'AlphaData',stone_Alp) End function dragongame (~, ~)% here is the background part of the code% written earlier. %. StonePos (:, 1) = stonePos (:, 1)-20 stonePos 3; stonePos (stonePos (:, 1)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.