Quantcast
Channel: cocos2d-x - Cocos Forums
Viewing all 2747 articles
Browse latest View live

Going From Unity to Cocos complete newb - need help

$
0
0

Hi I’ve had a quick scout and I can’t find anything quite what I’m looking for but if there are forum posts already like what I’m about to ask then I do apologize and please point me in that direction…

I am a hobbyist who would like to become an indie game dev someday, but with that said at the moment I have casually over the past few years followed many unity tutorials and got reasonably good with C#

After last years unity license fee shit show I’m looking at alternative engines and I’m curious to see if cocos is good for my specific needs.

My intention is to make F2P casual mobile games including Infinite Runners and hyper casual games. One thing I’m finding both confusing and discouraging is that there’s so many different versions of cocos with 2dx, creator a c# version and all sorts with very few tutorials online.

Can someone please point me in the right direction for the following.

  1. Is Cocos a good fit for what I’m looking for?

  2. Which cocos should I be using?

  3. Where should I start, please explain why there’s so few tutorials on youtube and if is it important to only follow newer tutorials or is this engine highly backwards compatible with older versions?

I’d love to hear the experience of any other former or current unity devs who use cocos.

With that said this is already getting quite long and thanks in advance for any responses.

3 posts - 3 participants

Read full topic


Is it possible? Knowing C++ only the basics, write games in Cocos?

$
0
0

Is it possible? Knowing C++ only the basics, write games in cocos. Hi all! Maybe explore opentk or other libraries for creating games in Cocos?

3 posts - 2 participants

Read full topic

Build wrong about com.enhance.gameservice

$
0
0

I was first to build cocos2dx-4.0 project,the below picture is the question


It tells me package com.enhance.gameservice doesn’t exist,I try to find answers on website,but I only
find several answer around 2016 year,anyone knows how to resolve it?Thanks.

1 post - 1 participant

Read full topic

Encryption signature using white space

$
0
0

How do I decrypt a file with a signature that uses white space like this?

Sign: White Space 10x Times
Key: BSSDdpQyRoeHDuo8

Screenshot 2024-07-06 233736

1 post - 1 participant

Read full topic

Keyboard won't close with Editbox

$
0
0

Here’s my code:

    player3Name = ui::EditBox::create(editBoxSize, ui::Scale9Sprite::create("whitebox.png"));
    player3Name->setAnchorPoint(Vec2(0, 0));
    player3Name->setPosition(Vec2(int_initialplayer3NameX, int_initialplayer3NameY));
    player3Name->setFontColor(Color4B::BLACK);
    player3Name->setPlaceHolder("Jay");
    player3Name->setInputFlag(ui::EditBox::InputFlag::INITIAL_CAPS_WORD);
    player3Name->setPlaceholderFontColor(Color4B::BLACK);
    player3Name->setMaxLength(12);
    player3Name->setText(UserDefault::getInstance()->getStringForKey("player3name").c_str());
    player3Name->setDelegate(this);
    player3Name->setReturnType(ui::EditBox::KeyboardReturnType::DEFAULT);

The keyboard comes up and let's me edit my label just fine.  problem is, when I hit the return button, nothing happens.  I've tried changing DEFAULT to DONE and it still doesn't close it.  Any ideas?

2 posts - 2 participants

Read full topic

Help Needed to Update Cocos2d Apps - Compensation Offered!

$
0
0

Hello developers’ community,

We urgently need assistance to update 11 mobile apps (iClassicsCollection) developed in Cocos2d. We are facing issues with the guidelines of major app stores and require experts who can address this effectively.

Compensation Available: We are willing to compensate your time and skills. Please contact efren@iclassicscollection.com to discuss further details.

1 post - 1 participant

Read full topic

Webview postmessage not working on android

$
0
0

I have been trying to send some data via postMessage in my webview, in Browser it workes fine but in android its not working

this.newWebView.evaluateJS( try { var meta = document.createElement('meta'); meta.httpEquiv = "Permissions-Policy"; meta.content = "accelerometer=self"; document.head.appendChild(meta); } catch (e) { console.error('Failed to set Permissions-Policy:', e); } try { window.postMessage({ type: 'authToken', token: '${token}' }, '${url}'); } catch (e) { console.error('Failed to post message:', e); } );
above one is my javascript code, can some one tell me how can i make it work for android device?

1 post - 1 participant

Read full topic

Build under AndroidStudio : No rule to make target 'cocos2dcpp' Stop

$
0
0

I’m trying to build an existing project that worked on previous env

But with mine I got this error :

Execution failed for task ':App:buildNdkBuildDebug[arm64-v8a][cocos2dcpp]'.
> com.android.ide.common.process.ProcessException: C++ build system [build] failed while executing:
      /Users/me/Library/Android/sdk/ndk/25.1.8937393/ndk-build \
        NDK_PROJECT_PATH=null \
        APP_BUILD_SCRIPT=/Users/me/Dev/my_app/proj.android/app-myapp/jni/Android.mk \
        NDK_APPLICATION_MK=/Users/me/Dev/my_app/proj.android/app-myapp/jni/Application.mk \
        APP_ABI=arm64-v8a \
        NDK_ALL_ABIS=arm64-v8a \
        APP_PLATFORM=android-19 \
        NDK_OUT=/Users/me/Dev/my_app/proj.android/app-myapp/build/intermediates/cxx/Debug/1912a613/obj \
        NDK_LIBS_OUT=/Users/me/Dev/my_app/proj.android/app-myapp/build/intermediates/cxx/Debug/1912a613/lib \
        NDK_TOOLCHAIN_VERSION=clang \
        -j10 \
        NDK_DEBUG=1 \
        cocos2dcpp
    from /Users/me/Dev/my_app/proj.android/app-myapp
  make: *** No rule to make target 'cocos2dcpp'.  Stop.

I don’t know if thats related but I’m using ndk 25.1.8937393, AGP 8.5.0, and build-gradle : 8.7

1 post - 1 participant

Read full topic


Cocos2d-x3.17 [How to ListView continous scroll when touch point leave Lisview Rect] ]

Color selector dont work

$
0
0

when i use the position of color selector stop working

	auto colorSelector = ColorSelector::create();
	colorSelector->setPosition(Vec2(visibleSize.width * 0.1, visibleSize.height * 0.2)); // Defina a posição desejada
	//colorSelector->setPosition(Vec2(layout->getPositionX() + layout->getContentSize().width / 2, layout->getPositionY() + layout->getContentSize().height / 2)); // Ajuste a posição desejada
	colorSelector->setLocalZOrder(1); // Defina a ordem de desenho para garantir que o ColorSelector esteja por cima do layout
	this->addChild(colorSelector);

what i doing wrong

2 posts - 1 participant

Read full topic

How to convert my code from cocos 2dx for axmol

$
0
0

i trying converting my code from cocos to axmol
but have alot off errors

auto closeButton = MenuItemImage::create("button_image.png", "button_image.png", AX_CALLBACK_1(MainMenu::menuCloseCallback, this));
closeButton->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 2 - 100));

i have this errors

Gravidade	Código	Descrição	Projeto	Arquivo	Linha	Estado de Supressão	Detalhes
Erro (ativo)	E0304	nenhum instância de função sobrecarregada "ax::MenuItemImage::create" corresponde à lista de argumentos	FirstGameVersion	C:\Users\paqa\source\repos\FirstGameVersion\Source\MainMenuScene.cpp	57		
Erro	C2665	'ax::MenuItemImage::create': nenhuma função sobrecarregada pode converter todos os tipos de argumento	FirstGameVersion	C:\Users\paqa\source\repos\FirstGameVersion\Source\MainMenuScene.cpp	57		

1 post - 1 participant

Read full topic

Camera zoom not respecting mask

$
0
0

Hello. I am working on a 2D game in cocos v2.3.4. I have just added a feature with a main camera to render my game elements and a secondary camera to render my UI so that the main camera can be zoomed without the UI moving. The problem is that now the final picture gets bigger in the game instead of staying within the defined size of the mask.

The heirarchy looks like this:

Canvas (mask)

Main Camera
UI Camera
Game Stuff

Everything else

I am zooming the camera by increasing the zoomRatio to 1.8.

I’ve read the relevant documentation and it seems like this should be working so I could use some help. Thanks

6 posts - 2 participants

Read full topic

How can I develop my own editor using Cocos engine

$
0
0

Cocos Creator is too comprehensive for the projects I am targeting. I want to make a simpler editor, I want to make an editor based on visual programming like Buildbox, but is it more logical to download and edit an open source version of Cocos Creator or write an editor from scratch using cocos2d-x engine? What should I start by researching.

1 post - 1 participant

Read full topic

Can I get *where* a TableViewCell was touched?

$
0
0

I have scroll bars in several of my screens. If the user taps within that vertical scroll area, I’d like to scroll, rather than touching the underlying cell. Is there a way in tableCellTouched() to get the coordinates of the touch event?

1 post - 1 participant

Read full topic

3.17.2 Crash cocos2d::Renderer::processRenderCommand(cocos2d::RenderCommand*) help me

$
0
0

[libMyGame.so!libMyGame.so] cocos2d::Renderer::processRenderCommand(cocos2d::RenderCommand*)

Scudo ERROR: invalid chunk state when deallocating address 0x


pid: 0, tid: 6449 >>> com.MyPackage <<<

backtrace:
#00 pc 0x00000000000513c4 /apex/com.android.runtime/lib64/bionic/libc.so (abort+180)
#01 pc 0x0000000000041438 /apex/com.android.runtime/lib64/bionic/libc.so (scudo::die()+8)
#02 pc 0x0000000000041b20 /apex/com.android.runtime/lib64/bionic/libc.so (scudo::ScopedErrorReport::~ScopedErrorReport()+32)
#03 pc 0x0000000000041d5c /apex/com.android.runtime/lib64/bionic/libc.so (scudo::reportInvalidChunkState(scudo::AllocatorAction, void*)+76)
#04 pc 0x000000000004337c /apex/com.android.runtime/lib64/bionic/libc.so (scudo::Allocator<scudo::AndroidConfig, &(scudo_malloc_postinit)>::deallocate(void*, scudo::Chunk::Origin, unsigned long, unsigned long)+308)
#05 pc 0x0000000000718800 /data/app/~~KTPKdaD-O0WxpH4fLdjA-Q==/com.MyPackage-1wjL0G2JJMjfWEEZLx-bRQ==/lib/arm64/libMyGame.so!libMyGame.so (cocos2d::Renderer::processRenderCommand(cocos2d::RenderCommand*)+104) (BuildId: dfe72a3ebce42989d9ab6a056c36ebb07853c263)
#06 pc 0x0000000000719238 /data/app/~~KTPKdaD-O0WxpH4fLdjA-Q==/com.MyPackage-1wjL0G2JJMjfWEEZLx-bRQ==/lib/arm64/libMyGame.so!libMyGame.so (cocos2d::Renderer::visitRenderQueue(cocos2d::RenderQueue&)+824) (BuildId: dfe72a3ebce42989d9ab6a056c36ebb07853c263)
#07 pc 0x0000000000718854 /data/app/~~KTPKdaD-O0WxpH4fLdjA-Q==/com.MyPackage-1wjL0G2JJMjfWEEZLx-bRQ==/lib/arm64/libMyGame.so!libMyGame.so (cocos2d::Renderer::processRenderCommand(cocos2d::RenderCommand*)+188) (BuildId: dfe72a3ebce42989d9ab6a056c36ebb07853c263)
#08 pc 0x0000000000719238 /data/app/~~KTPKdaD-O0WxpH4fLdjA-Q==/com.MyPackage-1wjL0G2JJMjfWEEZLx-bRQ==/lib/arm64/libMyGame.so!libMyGame.so (cocos2d::Renderer::visitRenderQueue(cocos2d::RenderQueue&)+824) (BuildId: dfe72a3ebce42989d9ab6a056c36ebb07853c263)
#09 pc 0x00000000007193cc /data/app/~~KTPKdaD-O0WxpH4fLdjA-Q==/com.MyPackage-1wjL0G2JJMjfWEEZLx-bRQ==/lib/arm64/libMyGame.so!libMyGame.so (cocos2d::Renderer::render()+112) (BuildId: dfe72a3ebce42989d9ab6a056c36ebb07853c263)
#10 pc 0x00000000006aa908 /data/app/~~KTPKdaD-O0WxpH4fLdjA-Q==/com.MyPackage-1wjL0G2JJMjfWEEZLx-bRQ==/lib/arm64/libMyGame.so!libMyGame.so (cocos2d::Scene::render(cocos2d::Renderer*, cocos2d::Mat4 const*, cocos2d::Mat4 const*, unsigned int)+464) (BuildId: dfe72a3ebce42989d9ab6a056c36ebb07853c263)
#11 pc 0x000000000073e008 /data/app/~~KTPKdaD-O0WxpH4fLdjA-Q==/com.MyPackage-1wjL0G2JJMjfWEEZLx-bRQ==/lib/arm64/libMyGame.so!libMyGame.so (cocos2d::Director::drawScene()+352) (BuildId: dfe72a3ebce42989d9ab6a056c36ebb07853c263)
#12 pc 0x0000000000740c2c /data/app/~~KTPKdaD-O0WxpH4fLdjA-Q==/com.MyPackage-1wjL0G2JJMjfWEEZLx-bRQ==/lib/arm64/libMyGame.so!libMyGame.so (cocos2d::Director::mainLoop()+128) (BuildId: dfe72a3ebce42989d9ab6a056c36ebb07853c263)
#13 pc 0x00000000020f5b08 /memfd:jit-cache (art_jni_trampoline+88)
#14 pc 0x000000000205df34 /memfd:jit-cache (org.cocos2dx.lib.Cocos2dxRenderer.onDrawFrame+292)
#15 pc 0x0000000002073208 /memfd:jit-cache (android.opengl.GLSurfaceView$GLThread.guardedRun+4088)
#16 pc 0x00000000002124c4 /apex/com.android.art/lib64/libart.so (nterp_helper+3924)
#17 pc 0x0000000000460d38 /system/framework/framework.jar (android.opengl.GLSurfaceView$GLThread.run+48)
#18 pc 0x0000000000218964 /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548)
#19 pc 0x00000000002851f0 /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+184)
#20 pc 0x0000000000628a24 /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValuesart::ArtMethod*(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+460)
#21 pc 0x0000000000678488 /apex/com.android.art/lib64/libart.so (art::thread::CreateCallback(void*)+1184)
#22 pc 0x00000000000b4b38 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+264)
#23 pc 0x0000000000052c60 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

It seems like some phones are having errors.
My phone (Galaxy S22+) doesn’t have any errors at all.

I got an error I hadn’t seen before after updating the app. Could it be related to AdMob?

What does the processRenderCommand method do?

help me plz

1 post - 1 participant

Read full topic


Cocos2d-JS 3.17 - Google rejected my app

$
0
0

Hi all!

Google Play has removed my app and disable my dev account. They said my app is malicious, malware. I don’t know why they marked my app as malware. It’s just a simple knife throwing game (like Knife Hit), totally offline. I don’t request any sensitive permissions in my app. I also upgraded Android SDK to latest version 34. I submitted and scanned my app with virustotal and they said it is safe. I made 2 appeal but they still keep their decision.

I think that Google has marked the js-engine as malicious, because their policy said they don’t allow dynamic code execution at runtime (Javascript, Lua is dynamic language). Is that right ? Should I use C++ version of Cocos2d instead of JS for building Play Store app ?

Below is email from Google

Hi Developers at Gamera Studio,

Thanks for contacting the Google Play team.

After reviewing your appeal, we have confirmed our initial decision and will not be able to reinstate your developer account.

Your Google Play Developer account has been terminated due to violations of the Deceptive Behavior policy. We expect app functionality to be reasonably clear to users, and we’ve determined your app includes hidden, dormant, or undocumented features.

Additionally, we’ve identified that your app, Knife Clash ( com.free.**), falls into one or both of the two categories below:

  1. Your app contains code that could put a user, a user’s data, or a device at risk, and/or
  2. Your app does not deliver on the promises made to the user.

Thank you in advance!

1 post - 1 participant

Read full topic

Looking for a Game Developer with Cocos2d Experience in Kuala Lumpur

$
0
0

We are currently seeking an experienced game developer with proficiency in Cocos2d for a project based in Kuala Lumpur, Malaysia. If you or someone in your network has expertise in Cocos2d and is located in the KL area, we would love to discuss potential collaboration opportunities.

Please feel free to reach out with any leads or further inquiries.

Thank you in advance for your time and assistance.

1 post - 1 participant

Read full topic

Maximum number of sprites?

$
0
0

I’m loading multiple spritesheets, and this year, I’m trying to load a lot more layers to support jersey numbers. However, I’m not seeing all the sprites loaded, and I I shifted the order to check if it was a problem in the images, but that’s not it. It seems that I’m hitting some sort of limit?

Is there a limit with the number of sprites or perhaps I’m hitting a memory limit?

I can’t figure a good solution for this without loading 22 sheets of jersey numbers to overlay the players. :frowning:

thanks!

1 post - 1 participant

Read full topic

Can't remove event listening

$
0
0

Hi! I’m currently working on a simple project, and as part of it, I needed to register player input.
So I added event listener, so whenever player presses inside parent node, other stuff happens.

onLoad() {
    this.node.parent.on(cc.Node.EventType.TOUCH_START, function (event) {
        this.Pressed = true;
        console.log("Pressed");
    }, this);        
    this.node.parent.on(cc.Node.EventType.TOUCH_END, function (event) {
        this.Pressed = false;
        console.log("Lifted");
    }, this);
}

And then way dowm the code I tried removing those, but it doesn’t seem to work

...
 this.node.parent.off(cc.Node.EventType.TOUCH_START, function (event) {
     this.Pressed = true;
     console.log("Pressed");
 }, this);
 this.node.parent.off(cc.Node.EventType.TOUCH_END, function (event) {
     this.Pressed = false;
     console.log("Lifted");
 }, this);
...

Code certainly does reach those commands, as other methods there seem to work, but nor .off(), nor even .destroy() called on this.node don’t remove the listeners.
Really need help with that as there should be many objects with that script and I really don’t want to pile up event listeners.
Also, probably important, I use cocos 2.4.10 + TS and don’t intend to switch version of this project

3 posts - 2 participants

Read full topic

Is there a reliable 3.x cocos typescript documentation I can learn with?

$
0
0

Just need documentation links, if you think you can help here’s my problem (usually everyone helps when it’s too late, hope that doesn’t happen!:c)

Okay problem fixed, but i still need reliable 3.x cocos typescript documentation. I’m also programming on typescript for the first time

3 posts - 2 participants

Read full topic

Viewing all 2747 articles
Browse latest View live