精品导航

Display

After an easy one, it's time for a slightly more difficult code.

In this example, we'll see how to make a green circle on the screen that bounces off the edges.

To begin, we must create four variables (x, y, dx, and dy).

X and Y represent the coordinates of the center of the circle, and DX and DY represent the amount by which the x and y coordinates move.

X and Y are the coordinates of the circle's center, while DX and DY are the amounts by which the x and y coordinates change.



Now, let's introduce the "loop forever" block, which will include all of the code that will run continuously.

We'll set the 'x' and 'y' to 20 and 60, and they'll always change by one, therefore the 'dx' and 'dy' must be set to 1.



Every 20 ms, the 'x' and 'y' variables will change by one.
As a result, we must set the value of these variables to the sum of that variable's value and 1.



When the circle reaches the display's edges, it will begin to shrink in size.

Because of that, we have to change its direction.

We do that with the "Logic" block.



So, whenever the circle reaches the edges, we chose to change the variable 'dx' to -'dx'.

The same goes for the 'y' and 'dy' variables.



Great!

The only thing left to do is draw a circle.

To do that, first we have to fill the background of the display with black:



Draw the filled circle in color green.

The radius of our circle is set to 5, and the x and y coordinates are set to the initial values of these variables.



To ensure that this circle appears on the display, add the "push frame" block at the end.



And, finally, add the time block "sleep 20 ms".



Click on the Run button and check it out!

If you want to put the stock firmware back onto your device, you can click the Restore firmware button in the top right corner on CircuitBlocks.

友情链接:玖玖资源站 | 蜜芽视频 | 青青伊人 | 青草草 | 欧美午夜 | 蘑菇tv网页版 | 五月丁香 | mogu | 日本高清 | 宅男影院 | 蘑菇视频入口 | tissu-premier.com | 老王影院 | 色啪 | 蘑菇网页版入口 | 小蓝视频 | mogu视频 | 红桃视频 | zhuoyemall.com | 协和影院 | 色妞 | 蘑菇短视频入口 | 青娱 | 福利盒子 | 老司机视频 | 屁屁影院 | 蘑菇传媒 | dna0126.com | 汤姆影院 | 天天综合 | 六月婷婷 | 蓝色导航 | 久久爱 | 樱花视频 | 蘑菇視頻 | 秋霞影院 | bt搜索 | 小草社区 | p站视频 | 性知音 | dk99999.com | lf397.com | 天堂在线 | 五福影院 | 秋霞网 | 蘑菇网 | 蘑菇视频ios | 四虎影视 | 番号网 | 伊人色 | 青草青青 | woqidz.com | 玖玖爱 | mogutv | 4008108885.com | 无名网 | 在线亚洲 | 蘑菇在线观看网页版 | btupic.com | zpzb2008.com | rencai98.com | 摩天轮社区 | 永久地址 | 福利精品 | 久久久久久 | fltou.com | 蘑菇影视 | jxty00.com | 酒色世界 | 迷妹网 | 久久香蕉 | sanzhucare-zhpg.com | 在线午夜 | gzdksw.com | 亚洲网 | 扒哥黑料 | mogus.cc | 久久视频 | 第一福利 | 琳琅导航 | 色婷婷 | hebeijiaoyuwang.com | 超碰视频 | 永久网站 | 资源导航 | 综合影院 | 午夜在线观看 | 蘑菇app | 亚洲精品 | 精品免费 | 最新av | 琵琶妞 | 龙物视频 | 看片神器 | 导航大全 | 草莓视 | 蘑菇视频网站 | 蘑菇传媒在线观看 | tsxhyq.com