New opensource simple game using Cocos2d-X version 3


#1

Hi,

This is a sample project that use the last version of Cocos2d-X, the version3.

I try make the simple things with this project to help anyone that need start cocos2d-x.

I will make when i get more time the TODO tasks in README of repository.

I converted some classes like SneakyInput to new version.

My goal is make a real player move and jump with SneakyInput, parallax background, box2d player, box2d ground, box2d limits, camera that move with player and a menu screen.

Please help us and all users. I start it. Help me advance it.

Link:


#2

what is this game? can I run it ?


#3

Yes. See the link. download and run. And help if you can :slight_smile:


#4

Now we have a simple Player (see the screenshot on github).

It move and jump. I put a sprite to simulate waking but have a bug. After constructor i cant change the player action, i got null exception. Can anyone help me?

It is using box2d now for all.

I have an issue created with this problem:

Thanks.


#5

Hi,

Can anyone help us with the bug? It is essential to the project walk.

I think that is a problem with retain/release but i dont found it :frowning:

Thanks.


#6

Hi,

I have update the project and Player class now have a create method to create new player with static method.

Now my problem is other, on update call from scheduleUpdate i update the player, but get an error BAD_ADDRESS, but the player is a member of current scene, if never will deleted until the scene release it, correct?

Can anyone help me?

I have attached a screenshot. The source is on screenshot but you can see on github repo. too.

Thanks team.


#7

I see that my problem is with retain/release/pool, because if i put a lot of retain, it works and after change the animation sometimes, i get null exception.

But how the retain count can be go to ZERO if i have an instance allocated to the LAYER class (HelloWorld)?

I built a small c++ example that shows that my class instance is not auto-released if his scope go out.

DIRECT CODE: http://ideone.com/fDpMB9

#include
>
using namespace std;
>
class Animal
{
>
public:
>
Animal()
{
cout << “Animal::Animal” << endl;
}
>
~Animal()
{
cout << “Animal::~Animal” << endl;
}
>
};
>
int main()
{
cout << “START” << endl;
>
bool firstTime = true;
bool deleteIt = false;
>
if (firstTime)
{
Animal *animal = new Animal();
>
if (deleteIt)
{
delete animal;
}
}
>
cout << “FINISH” << endl;
return 0;
}
>

You can paste it on a online cpp IDE like: http://codepad.org .

You will see that the destructor is not called until i call DELETE.

So, in my logic, the pool cannot release an instance that is allocated in a alive class that is the game LAYER (Hello World).

Im correct or wrong?


#8

I’m using version 3.0 stable but I run problems on TargetedTouchDelegate.