Cocos Creator入门实战:桌球小游戏(1)
How to make a simple snooker game with CocosCreator (1)
桌球小游戏是 BigBear (引擎组大佬)设计、撰写的中英双语的 Cocos Creator 入门教程,面向 Cocos Creator 初学者,但不论你当前技术如何,相信你在 BigBear 老师的带领下定会有所收获。
Shawn 昨天推送了完整的中文版本,为了降低大家的学习难度,我将《Cocos Creator入门实战:桌球小游戏》一文拆分成若干篇中英双语的教程,我们一起学习游戏、学习英语(看我公众号的名字就知道Shawn的英语有多low)!
开始之前 Before Start
在开始桌球小游戏之前,我们需要对creator有一定了解以及熟悉,对js语法有一定的了解。在开始同样还是希望大家能够仔细的阅读一遍官方文档,以便理解。
Before start things with Cocos Creator to make our game, you should have a familiarity understanding with Cocos Creator.if there are any questions in the production, pls check those Cocos’s offical document:
所涉及到的知识点参考:
- Physics
- UI System
- Listen to and launch events
- Actions and Action Lists
- Prefab
- Atlas Asset
ps:本项目所使用的Cocos Creator版本为 v2.0.10
ps: this tutorial is based with Cocos Creator v2.0.10
开启物理系统 (Use physics system)
为了尽量达到真实的效果,我们对于桌球的运动均采用物理模拟来实现。
在Cocos Creator中物理系统是默认关闭的,我们可以通过下面的代码来开启物理系统:
We use physical simulation to acheieve the movement of the balls, so the balls can move as much as reality movement.Physics system is closed by default in Cocos Creator, we can open it with those code:
let physicsManager = cc.director.getPhysicsManager();
physicsManager.enabled = true;
同时我们也可以通过设置debugDrawFlags来开启一些调试信息的显示,方便我们开发预览:
also we can set physics system to a debug mode that we can see more debug info in preview:
cc.director.getPhysicsManager().debugDrawFlags = cc.PhysicsManager.DrawBits.e_aabbBit |
cc.PhysicsManager.DrawBits.e_pairBit |
cc.PhysicsManager.DrawBits.e_centerOfMassBit |
cc.PhysicsManager.DrawBits.e_jointBit |
cc.PhysicsManager.DrawBits.e_shapeBit;
完整链接 :
https://mp.weixin.qq.com/s/aY5Krqua1m43_N7b80gxIA
原文连载进行中,请关注微信公众号「奎特尔星球」,一起编程、英语、娱乐、学习、交友!

