cc.Node.scheduleUpdate:function ()

* schedules the "update" method.                                                                         

     * It will use the order number 0. This method will be called every frame.                             

     * Scheduled methods with a lower order value will be called before the ones that have a higher order value

不断地运行 Update方法

与之相应的是

scheduleUpdateWithPriority:function (priority) 

schedules the "update" callback function with a custom priority.

unscheduleUpdate:function ()

unschedules the "update" method.

=============================================================

向量的运用

        // Determine the length of how far you're shooting
var offset = cc.pSub(realDest, projectile.getPosition()); //求出offset,这是一个向量差值,比方realDest=(1,1),projectilePos=(3,4),求出结果应该是一个(2,3)的向量
var length = cc.pLength(offset);//Calculates distance between point an origin 。 简单2维理解就是求出距离
var velocity = 480.0; //如在这里设置一个速度变量
var realMoveDuration = length / velocity;//简单的计算一个速度

今天,一个 错误。浪费了几个小时的时间。

在cocos2D.js里面。一定要注意令到main.js在最后载入。否则在其后面的文件都无法訪问, prompt referenceError

入下例。假设loading.js放在最后,则载入loading场景的时候,会出错。由于loading文件下定义的类都无法訪问

        tag:'gameCanvas',

        // 2
engineDir:'./Platform/HTML5/cocos2d/',
//Please make sure main.js is the last loading item otherwise the js behind that will not take effective
appFiles:[
'./Src/Loading.js',
'./Src/resource.js',
'./Src/MainLayer.js',
'./Src/config/GameConfig.js',
'./main.js',
// './Src/Loading.js'
]

开启精灵的debug mode , 在main.js的 applicationDidFinishLaunching加入例如以下代码

        //Here to enable the sprite debug draw mode
//0: not enable sprite debug draw
//1: draw bounding box
//2: draw texture box
cc.SPRITE_DEBUG_DRAW = 1;

//Here to enable the sprite debug draw mode //0: not enable sprite debug draw //1: draw bounding box //2: draw texture box cc.SPRITE_DEBUG_DRAW =
1; //load resources// cc.LoaderScene.preload(g_resources, function () {// RL00001 the default loading are there

COCOS2D 学习笔记的更多相关文章

  1. cocos2d学习笔记

    doxygen工具 生成cocos2d的api文档 位图字体编辑工具 Glyph Designer http://www.71squared.com/glyphdesigner  收费的 CCLabl ...

  2. cocos2dx游戏开发——微信打飞机学习笔记(三)——WelcomeScene的搭建

    一.场景与层的关系: cocos2dx的框架可以说主要由导演,场景,层,精灵来构成: 1.其中导演,意如其名,就是操控整个游戏的一个单例,管理着整个游戏. 2.场景就像电影的一幕剧情,所以说,懂得如何 ...

  3. android cocos2d-x for Android安装和学习笔记(请用adt-bundle21.1或以上导入)

    引用:http://weimingtom.iteye.com/blog/1483566 (20121108)注意:这篇文章用cdt编译ndk工程的内容已过时(现在可以用adt-bundle,避免配置繁 ...

  4. [Cocos2d-x for WP8学习笔记] HelloWorld结构分析

    先来看一下目录结构: Assets:游戏资源文件,图片音频等,Resource文件夹也有类似功能 include:用于放置游戏头文件 Shaders:渲染器着色器文件(大雾) cocos2dorig. ...

  5. cocos2d-x实战 C++卷 学习笔记--第4章 字符串 __String类

    前言: <cocos2d-x实战C++卷>学习笔记.(cocos2d-x 是3.0版本) 介绍 cocos2d-x 通用的字符串类  __String . 使用cocos2d::__Str ...

  6. Cocos2d-x学习笔记(17)(TestCpp源代码分析-1)

    TestCpp源代码基于Cocos2d-x2.1.3版本号,部分资源来自红孩儿的游戏编程之路CSDN博客地址http://blog.csdn.net/honghaier/article/details ...

  7. 《Cocos2d-x游戏开发实战精解》学习笔记4--实战一个简单的钢琴

    上一节学习了使用Cocos2d-x播放音乐的方法,但是那种方法一般只适合于播放较大的音乐,而一般比较短小的音乐(如游戏中的打斗.按键音效等)则要通过playEffect来播放.本节使用该方法以及之前学 ...

  8. 《Cocos2d-x游戏开发实战精解》学习笔记3--在Cocos2d-x中播放声音

    <Cocos2d-x游戏开发实战精解>学习笔记1--在Cocos2d中显示图像 <Cocos2d-x游戏开发实战精解>学习笔记2--在Cocos2d-x中显示一行文字 之前的内 ...

  9. cocos2d-html5学习笔记(六)--alpha2中cc.Sequence.create中的bug

    cocos2d-html5学习笔记(六)--alpha2中cc.Sequence.create中的bug http://blog.csdn.net/allenice1/article/details/ ...

随机推荐

  1. jmeter 3.x plugins 的使用

    JMeter Plugins 一直以来,JMeter Plugins为我们提供了很多高价值的JMeter插件,比如: 用于服务器性能监视的PerfMon Metrics Collector 用于建立压 ...

  2. RESTful 设计理论

    RESTful 设计: 1.协议通信协议:https 2.域名部署在API专用域名下,除非API很简单(https://www.example.com/api)https://api.example. ...

  3. MySql(二):常见的那些个约束

    今天总结一下mysql当中的常见约束吧! 那什么是约束呢?通俗点讲,约束就是限定指定字段的存放规则! ● 主键约束(Primary Key) ● 外键约束(Foreign Key) ● 非空约束(No ...

  4. 研磨JavaScript系列(一):回归简单

    想要理解JavaScript,你得首先放下对象和类的概念,回到数据和代码的本原.编程世界只有数据和代码两种基本元素,而这两种元素又有着纠缠不清的关系.JavaScript就是把数据和代码都简化到最原始 ...

  5. html5——多列布局

    基本概念 1.多列布局类似报纸或杂志中的排版方式,上要用以控制大篇幅文本. 2.跨列属性可以控制横跨列的数量 /*列数*/ -webkit-column-count: ; /*分割线*/ -webki ...

  6. 打造最强NGINX HTTPS

    SSL LABS 检测 完整配置如下 server { listen 443 ssl; server_name xxx.xxxke.com; ssl on; ssl_certificate /xxx/ ...

  7. python 将中文转拼音后填充到url做参数并写入excel

    闲着没事写了个小工具,将中文转拼音后填充到url做参数并写如excel 一.先看下演示,是个什么东西 二.代码 代码用到一个中文转拼音的库,库是网上下的,稍微做了下修改,已经找不原来下载的地址了,然后 ...

  8. get传数组

    开发真的处处都是坑呀 ajax get请求,传数组,想当然的给了个json数组['','',''],结果500错误 正确的方式,多次赋值,见下图,后台会自动转数组

  9. R包

    查看默认安装包的位置 .libPaths() 移除包 remove.packages("package_name") 查看所有安装的包 library() 按 q 退出包列表   ...

  10. vue移动端地址三级联动组件(二)

    继续上一篇: 子组件css: <style scoped lang="less"> #city { width: 100%; height: 100%; positio ...