当前位置:网站首页>Flutter 游戏教程之使用 Flutter 和 Flame 重现著名的 T-Rex 游戏
Flutter 游戏教程之使用 Flutter 和 Flame 重现著名的 T-Rex 游戏
2022-08-08 09:58:00 【知识大胖】
Flutter 游戏教程之使用 Flutter 和 Flame 重现著名的 T-Rex 游戏
这个想法
所以我把我的东西放在一起,开始想知道如何用 Flutter 制作游戏,最重要的是要做什么。由于我没有任何游戏开发经验,因此我选择不从头开始创建游戏,而是从另一个平台移植一个众所周知的开源简单游戏。在这种情况下,没有比离线时间的乐趣更适合的游戏了:Google Chrome 的 TRex。
让我们Flutter 吧
实现游戏循环所需的所有抽象、将对象绘制到画布上的工作以及将精灵放入对象的代码,所有这些都是由极简 2d 游戏引擎Flame实现的。
舞台已准备就绪:我们了解了 TRex HTML5 的工作原理,并且我们在 Flutter by Flame 中完成了一半的工作。
Horizo n和TRex等类很容易移植到 Flame 的组件概念。Runner是我们的游戏。某些组件中存在的诸如 Update 和 Draw 之类的方法在 Flame 方面也有类似的方法(更新和渲染)。
TRexGame 类是我们的“Runner”:
class TRexGame extends BaseGame{
TRex tRex;
Horizon horizon;
GameOverPanel gameOverPanel;
T
边栏推荐
- HMS Core分析服务智能运营6.5.1版本上线
- Stanford Fall 21: Practical Machine Learning [Chapter 5]
- 左益豪:用代码创造一个新世界|OneFlow U
- AI引领一场新的科学革命
- Redis 定长队列的探索和实践
- Is it safe to buy stocks with a straight flush?Will the funds be transferred?
- Interviewer: Have you ever used a lock at work?Talk about the advantages, disadvantages and usage scenarios of optimistic locking and pessimistic locking
- A concise tutorial on expanding (increasing capacity) of VMWare Esxi virtual system data storage
- 梯度消失和梯度爆炸问题详解
- 写在 26 岁生日
猜你喜欢
随机推荐
开源一夏|Flutter实现搜索的三种方式
shell脚本知识记录
LVS负载均衡群集
小散量化炒股记|打包Py可执行文件,双击就能选出全市场稳步上扬的股票
HMS Core分析服务智能运营6.5.1版本上线
让百姓消费更安全更放心更满意 江苏出台放心消费创建示范认定管理办法
Excel method is commonly used in text function 5
Practical Case: Building Churn Prediction Models with PySpark ML
移动端/嵌入式-CV模型-2018:MobileFaceNets
hdu4635 Strongly connected(tarjan计算强连通通分量+缩点+思想)
PCBA电路板为什么需要使用三防漆,有何作用?
软件测试的分类
Detailed Explanation of Gradient Vanishing and Gradient Explosion Problems
.json()的使用
Is it safe to buy stocks with a straight flush?Will the funds be transferred?
各位大佬想问下, flinkcdc采集oracle我看了下延迟大概两分钟左右,想问下有啥解决方法吗
等式变换(2015届华为校园招聘机试题第三题 )
面试官:工作中用过锁么?说说乐观锁和悲观锁的优劣势和使用场景
Open source summer | Three ways to implement search in Flutter
继承关系下构造方法的访问特点: