cocos2d-html5

Cocos2d-html5循序渐进(1)-开发环境配置

给你一囗甜甜゛ 提交于 2020-03-01 14:11:18
工先欲其事,必先利其器。 本章将涉及到Cocos2d-html5的开发环境的搭建,当然,如果你已经有可以使用的环境,那你就可以跳过本章。 第一步,下载Cocos2d-html5引擎,下载地址: http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Download ,如图: 第二步,选择web环境。现在市面上有很多web环境,比如:WAMP、XAMPP等。这里推荐一款国人写的作品-APMServ ( http://apmserv.s135.com/ )。我这里下载的是APMServ5.2.6的版本。 第三步,将上面两步下载的压缩包分别解压,解压后将Cocos2d-html5文件夹下的内容全部复制到APMServ中的/www/htdocs目录下,启动APMServ的服务。如图: 第四步,该看效果了,打开自己的浏览器,在URL栏中输入http://localhost,即可看到Cocos2d的一些Demo及开放项目。如图: 大功告成!先看看Cocos2d-html5的神奇魅力吧。。。 (via: http://www.codeinlive.com/217.html ). 来源: oschina 链接: https://my.oschina.net/u/225067/blog/140343

What is the better way to get mouse hold time?

淺唱寂寞╮ 提交于 2019-12-24 22:42:46
问题 I'm trying to count the time that player is holding the mouse button down. I tried this but it didn't works: var Game = cc.Layer.extend({ count: false, countTimer: null, init: function () { var selfPointer = this; this.canvas.addEventListener('mousedown', function(evt) { selfPointer.count = true; selfPointer.countTimer = window.setTimeout(selfPointer.Count(), 1); }); this.canvas.addEventListener('mouseup', function(evt) { selfPointer.count= false; window.clearTimeout(selfPointer.countTimer);

cocos2d-js moveTo and animate action

醉酒当歌 提交于 2019-12-12 02:07:08
问题 I have a moveTo sprite action and I am trying to have the sprite animate while moving. It is a waling animation. My trouble is I can make the sprite moveTo or animate but not both together so that when the sprite stops moving the animation goes back to the standing frame. I am using cocos2d-js v3.0 this.sprite = new cc.Sprite.create("#player-stand-f-0"); this.sprite.setPosition(new cc.Point(300,300)); this.addChild(this.sprite); var animFrames = []; var str = ""; for (var i = 0; i < 5; i++) {

Cocos2D-JS can't load json file exported from CocosStudio

懵懂的女人 提交于 2019-12-11 01:25:20
问题 I'm trying to load a json file exported from cocosstudio v2.3.2 var myScene = ccs.sceneReader.createNodeWithSceneFile('res/Scene.json'); I got this code from sample-cocos2d-js-scene-gui-master The problem is, i get this error: Can't find the parser : undefined How do i fix this issue? I'm very new to using javascript and I hope someone can help me with this. Thank you. 回答1: try to use ccs.load("") It's new api. This function returns table {node, action} node it's your scene "node" and "action