Questions tagged [cocos2d-python]

Python-based open source framework for building 2D games and graphical applications for Windows, Mac and Linux desktop computers.

Cocos2D is a Python based open source framework for building 2D games and graphical applications for Windows, Mac and Linux desktop computers. Cocos2D is published under a BSD License.

Due to the low popularity of Cocos2D (Python) please use the tag in Cocos2D (Python) related questions. The tag has become synonymous with due to the immense popularity of the Cocos2D for iPhone (and Mac) port.

Please refer to the description of the or tags for more information about the Cocos2D game engines.

33 questions
1
vote
2 answers

Load image with pyglet turns some transparency pixels white

I'm using cocos2D-python and I am loading images with pyglet.image.load and pyglet.resource.image but it still adds some white pixels where it is suppoused to be transparent. I've used pygame before but never experienced it with that. If it matters…
Frothiny
  • 71
  • 9
1
vote
2 answers

Twisted: How is Deferred called from EndPoint when using pyglet-twisted

The code below is taken from Twisted's documentation on AMP (link). When a callback is added to d, there's automatically a "protocol" argument added to it and the deferred is automatically run when reactor.run() is called. def connect(): …
Rob Guo
  • 152
  • 1
  • 5
1
vote
1 answer

Python Cocos2d: tiles show up only once

I'm working on a custom tiled map loader. Seems to work fine, I don't get any errors, but the screen only shows up 1 tile of each type. this is the file structure: /main.py /other/render2.py /other/render.py here's the render2.py file: import…
phyce
  • 65
  • 5
0
votes
1 answer

Removing cocos2d-python from Mac

I installed cocos2d today on OS X Lion, but whenever I try to import cocos in the Python interpreter, I get a bunch of import errors. File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/2.7/lib/ …
Assil Ksiksi
  • 344
  • 1
  • 3
  • 13
0
votes
1 answer

Cocos2d scene only taking quarter of screen, how do I fix it?

I'm trying to create a very basic cocos2d program, but the scene only takes up 1/4 of the window starting from bottom left corner to middle of the window. I tried changing the scene's position with scene.position= x,y but cocos seems to treat the…
Xzayler
  • 1
  • 3
0
votes
1 answer

Python Cocos2d can't find resource image after resizing it

I'm trying to resize an image in Python and then load a cocos2d sprite with the resized image. However, trying to initialize a cocos2d sprite results in an error that the resource can't be found. Example code to reproduce the problem: from pathlib…
Postie
  • 324
  • 3
  • 15
0
votes
1 answer

Animated scenes transition in cocos2d (python)

I am working on simple 2d game and trying to transition from game scene to next scene (game over or game won) depending on the collision with certain objects in game scene. When I call the NextScene function from the game scene the code works fine…
sadamiak
  • 1
  • 2
0
votes
1 answer

Packaging Python Cocos2D into an executable

We're working on a Cocos2D game for Ludum Dare right now, and we are having issues packaging the game into an executable of some kind. We have tried using py2exe, but it doesn't seem to work. I've read that py2exe often causes problems with this…
Oersted
  • 175
  • 2
  • 8
0
votes
1 answer

Python Cocos2d Label class is ignoring color

I'm using the Python Cocos2D game library and in their docs you can find cocos.text.Label which accepts color=RGBA(int, int, int, int) as params. I've got the following code create a Label: self.name = cocos.text.Label("Test Label", …
Aitor Martin
  • 724
  • 1
  • 11
  • 26
0
votes
1 answer

Key polling with cocos2d-python and pyglet

I'm trying to move a sprite while a key is pressed. I can do it with on_key_press() and on_key_release(), but with these I run into problems with moving right while holding left and vice versa. I'd like to use key polling and found this from the…
0
votes
1 answer

Move a sprite along a particular direction cocos2d

I want to move a sprite along a particular direction until next keypress in cocos2d. The code to handle a keypress is as follows, def on_key_press(self, symbol, modifiers): if symbol == key.LEFT: DIRECTION="left" …
sand
  • 183
  • 1
  • 10
0
votes
1 answer

cocos2d process events randomly while animating

This problem is so weird that I think I'm doing a huge mistake somewhere. I'm using cocos2d in python3. I created a simple example, which basically is a merge of samples/hello_world.py and samples/handling_events.py, and just visualize a moving text…
AkiRoss
  • 11,745
  • 6
  • 59
  • 86
0
votes
1 answer

How to flip a sprite among X or Y axis in cocos2d-python

I´m starting with cocos2d for python and would like to flip a sprite among its x (or y) axis. From what I gather this should be possible with the underlying pyglet lib but I couldn´t figure out how. I tried it like this: class…
perelin
  • 1,367
  • 1
  • 17
  • 32
0
votes
1 answer

python cocos2d change tile's image

-I'm using python and cocos2D I have the file loading a tmx-map but now I want to change a specific tile to display an image from another file, I have saved the specific tile that I want to change in a variable but changing it I don't know…
Frothiny
  • 71
  • 9
0
votes
1 answer

Cocos2d and Pyglet installation non-functional

After installing both by moving them into the Lib folder of my python installation, I get this error when trying to import cocos. Traceback (most recent call last): File "C:/Users/test/PycharmProjects/Testing/main.py", line 1, in
Connorelsea
  • 2,308
  • 6
  • 26
  • 47