Questions tagged [cocos2d-html5]

An open-source web 2D game framework, cross platforms between browsers and native applications with the C++ bindings to cocos2d-x.

Cocos2d-html5 is an open-source web 2D game framework, released under MIT License. It is a HTML5 version of Cocos2d-x project. The focus for Cocos2d-html5 development is around making Cocos2d cross platforms between browsers and native applications. On top of the framework provided by Cocos2d-html5, games can be written in Javascript, using an API that is COMPLETELY COMPATIBLE with that of Cocos2d-x javascript binding. Cocos2d-html5 project can be easily run on browsers which supports HTML5. Cocos2d-html5 also supports running game code in "Cocos2d Javascript binding" without or with little modification.

63 questions
1
vote
1 answer

cocos2d-js moveTo and animate action

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…
Keith Power
  • 13,891
  • 22
  • 66
  • 135
1
vote
0 answers

Cocos2d-x HTML5 with Angular JS in Single page application

I've got a Cocos2d-x html5 game developed, and it works fine. However I'm in the process of porting my front-end to SPA using angularjs. Therefore, there are no redirects, as pages are loaded dynamically. There is a problem with loading engine…
1
vote
1 answer

Cocos2d-js EditBox zOrder not working

I have an EditBox on my layer. var ebox = new cc.EditBox(cc.p(200, 30)); ebox.setPosition(size.width / 2 - 50, size.height /…
Akima
  • 121
  • 8
1
vote
1 answer

cannot get cc.point and delay to work together

OK think Space Invaders and Galaga. I have an enemy squadron at the top of the screen. They move left and right and down the screen as a group. Every now and then an enemy fighter leaves the group and attack's the player's ship. does a few bezier…
Bruno
  • 17
  • 4
1
vote
1 answer

object is not a function in menuitem

I'm getting this error message from Chrome Console, when I push a Menu item that tries to change the scene: Uncaught TypeError: object is not a function CCMenuItem.js:174 cc.MenuItem.cc.Node.extend.activate…
user3511563
  • 397
  • 2
  • 5
  • 18
1
vote
0 answers

Cocos2d-js/html5 inside a Django app

I'm trying to use Cocos2d-html in a Django app. From a HTML file, I need to refer to cocos2d.js, and from cocos2d.js I need to refer to another Javascript files. Cocos2d.js is located in the [static folder]/js/ The other .js files that I need to…
user3511563
  • 397
  • 2
  • 5
  • 18
1
vote
0 answers

creating 2 class instances doesn't work in cocos2D Javascript

In cocos2D-HTML5 I can't create 2 instances from 1 class. I use the engine cocos2D HTML 5 version. The issues is I have a moving platform the first created instance will move. When I add the second platform. The first and second platform won't…
1
vote
1 answer

How to animate sprite from plist file

I'm new to Cocos2d and I have problem with animations in Cocos2d-HTML5. Below is my sprite's constructor function. I've generated plist file with TexturePacker. I would like to play animation and repeat it infinitely. I was able to play it once by…
Łukasz Jagodziński
  • 3,009
  • 2
  • 25
  • 33
1
vote
1 answer

WebGL blend issue when drawing semi-transparent sprite to non-black background (cocos2d html5)

I'm experimenting with the Cocos2d HTML5 framework but believe this is a standard WebGL problem I cannot pinpoint as I don't have good knowledge on the topic. If I have a standard PNG image with semi-transparent pixels such as soft edges, and if…
Sam J
  • 25
  • 2
  • 3
1
vote
3 answers

What is the better way to get mouse hold time?

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; …
DontVoteMeDown
  • 21,122
  • 10
  • 69
  • 105
1
vote
0 answers

html5 game engine, cocos2d vs construct2

Just a beginners question, I am looking into html5 game engine for mobile devices, possible integration with Phonegap. mainly targeting iphone5 and iOS 7, I see that cocos2d is 2d only, but the question is construct2 vs cocos2d-html. if only…
user2412555
  • 1,055
  • 1
  • 16
  • 32
1
vote
1 answer

cc.Class.extend not respecting functions

When ever I run the code below in Cocos 2D HTML or with bindings it seems to not add any of my functions but will add my Variables. So: cc.Class.extend({ init: function(isDancing){ this.dancing = isDancing; }, age : 5, dance:…
James Campbell
  • 3,511
  • 4
  • 33
  • 50
1
vote
1 answer

Cocos HTML 5, Animating Sprite

I was wondering how I would move a sprite from the centre of the screen to being 10 pixels from the top edge of the screen. Thus making it look like its moving up. This is my code so far var LoginLayer = cc.Layer.extend({ init:function () { …
James Campbell
  • 3,511
  • 4
  • 33
  • 50
1
vote
2 answers

Cocos2d-html5-WebGL: Documentation required to learn and develop Cocos2d-html5-WebGL programming

I am trying to use Cocos2d-html5 framework (v 2.1.x) with WebGL programming concepts to develop 3d application. I am able to see documentation only for Cocos2d-html5 programming, and not finding any tutorials, API documentation and samples to do it…
1
vote
2 answers

How to access the function on outer Object in Javascript

I cant call method() inside FB.api. how can I access method? cant do it this.method(); or method(); var MyLayer = cc.Layer.extend({ init: function(){ FB.init({ ............ }); FB.getLoginStatus(function(response) { …
Jeff Lee
  • 783
  • 9
  • 17