Quantcast
Channel: Cocos Forums - Latest topics
Viewing all 17090 articles
Browse latest View live

Is my understanding of the Rect class correct?

$
0
0

@mza_299 wrote:

I wrote the following code:

this.overlappingRect = new cc.Rect((this.node.x - this.node.width/2), (this.node.y - this.node.height/2), this.node.x+this.offset, this.node.y+this.offset);

During simulation, I am getting unwanted results from Rect.intersects.

My undertanding is that the Rect is drawn from position x and y and the height/width is calculated from that point. I’m thinking the way that MonoGame implements Rects.

Is this correct?

Posts: 1

Participants: 1

Read full topic


Streaming on videoplayer

$
0
0

@smellypotato wrote:

I have a link with wss protocal which is a video streaming url in flv format. Is it possible to stream the video on cocos creator with videoplayer component or other method?

Posts: 1

Participants: 1

Read full topic

Cocos-BCX Bi-Weekly Technical Report (2.18–3.3)

$
0
0

@Summer.Yang wrote:

Over the past two weeks of February 18th-March 3rd , Cocos-BCX R&D team has made new technical progress .

1. Completed

1.1) Successfully implemented new registration module in the new Cocos-BCX chain system.

1.2) Updated Cocos-BCX blockchain system .

1.3) Tried optimizing nodal tolerance to explosive transactions .

1.4) Finished connecting new module and wallet .

1.5) Enhanced load capacity of the nodes.

1.6) Repaired abnormal controls of ownership when clearing up NHT orders.

2. In Verification

2.1) Trying adjusting committee authority .

Thank you for reading!

Cocos-BCX official channels:

Official website: http://www.cocosbcx.io/en/

Blog: https://medium.com/cocosbcx

Telegram: https://t.me/cocosblockchainexpedition

Twitter: https://twitter.com/cocosbcx

Reddit: https://www.reddit.com/r/cocosbcx/

Discourse Forums: https://discuss.cocos2d-x.org/c/cocos-bcx

Posts: 1

Participants: 1

Read full topic

FileUtils::getInstance() Runtime Error (3.17.1)

$
0
0

@MuratAlbayrak wrote:

I used v3.15 until now… I’ve updated to v3.17.1 last week and realized that JNI (C++ <-> Java Communication) has been rewritten.

When I try to use FileUtils I get a Runtime Error (in the JNI Part)

It does only happen on my old Phone Samsung Galaxy S3 (Android 4.3 Jelly Bean).
Has the minimum supported OS Version changed?

Can someone confirm this bug? Would be nice if someone could try this on older Phones with older Android Versions.

Posts: 1

Participants: 1

Read full topic

Code after load prefab not being executed...

$
0
0

@rsamrry wrote:

hi,
I want to know whether loading a prefab and instantiating takes a lot of time and how to perform actions on the prefabs in that case…here is the code :

        cc.loader.loadRes("Category", function (err, prefab) {
            self.catNode = cc.instantiate(prefab);
            self.node.addChild(self.catNode);
        });

            this.catNode.position.y = this.yTop;
            this.catScript = this.catNode.getComponent("GameCategoryStorage");

            this.catScript.txt = this.gameCatJSON["title"];

I have a prefab Category in the resources folder. in the prefab I have a tree structure of nodes where the root node contains a typescript file called gameCategoryStorage that contains a class GameCategoryStorage . I am getting errors where I try to set the y position of the catNode, and am also getting an error when I assign a string value from JSON to catScript.txt where txt is a string field in the class.
could someone tell me what I am doing wrong??? I think the prefab is taking time to load and that is why I can’t perform actions on the instantiated prefab soon after the loaders code. if so how do I get around it? for example how do I add a delay inside the code if that’s the solution???

thanks!!!

Posts: 2

Participants: 2

Read full topic

Windows Keyboard Input

$
0
0

@johnny2d wrote:

How to use CC_CALLBACK_2?

All the example code I have found appears to work without defining CC_CALLBACK_2 or they are showing all their code except code pertaining to CC_CALLBACK_2 definition.

I saw the example code on the cocos2dx site and it doesn’t work. ( I changed KeyboardTest to the class I am using.)

auto listener = EventListenerKeyboard::create();
listener->onKeyPressed = CC_CALLBACK_2(KeyboardTest::onKeyPressed, this);
listener->onKeyReleased = CC_CALLBACK_2(KeyboardTest::onKeyReleased, this);

_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);

// Implementation of the keyboard event callback function prototype
void KeyboardTest::onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event)
{
        log("Key with keycode %d pressed", keyCode);
}

void KeyboardTest::onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event)
{
        log("Key with keycode %d released", keyCode);
}

Is this the correct way to make a onkeyPressed listener? The only example code I have found is from several years ago and I’m not sure if this is how to handle key presses in 2019.

Please help

Posts: 4

Participants: 3

Read full topic

Force load resource or clone object

$
0
0

@oziphantom wrote:

So I’m using Creator but I think this is more a JS problem, although I’m actually using TS.

So I have json files which hold my stats and info about units. They basically make units. And I load one in using
cc.loader.loadRes(‘playerUnitData/’+filename,cc.JsonAsset,
function(err,data){
and this was working fine, however it seems to cache the asset. So when I try and load multiple of them they all get the same object, so ones HP goes to 0 every unit of the same type goes to 0. Is there a way to force unique load each time so I get a unique object each time? Or an easy way to clone the data, I’ve done searches and it seems there is no solid way to clone in TS/JS. I really don’t want to have to write code to handle and manually copy each field again and again and again. Its boring, brittle and defeats the purpose of using a language that just makes objects from JSON.

Posts: 2

Participants: 2

Read full topic

GDPR and IP collection

$
0
0

@crugthew wrote:

Hi,

Using SDKBOX with just the SDKPlay plugin there seems to be no option to toggle the GDPR compliance settings for the user to stop the plugin collecting data, such as IP adress which is a violation.

Am I reading that wrong or is there something missing?

Are there any plans to add a framework-wide GDPR toggle?

Cheers

Posts: 1

Participants: 1

Read full topic


[PAID] Need a Mobile App Created for my WebGame

$
0
0

@Elitis wrote:

Cocos2D App for my webgame

My webgame is http://senpa.io

I need someone to create a mobile client for it in Cocos2d.

I have my own custom backend with TypeScript for the servers, the Mobile App will connect to the same servers as the PC version. (I use websockets)

I need the design to be very clean, and the app to run very smooth, an example of a design that I like is the Agar.io mobile app

I want to also integrate Admob ads to the app.

I also want push notifications using onesignal

I also want something which will force the users to update the app if a new version is available

The app must implement my full protocol, my protocol is documented very well and I will give access to my server and web client for reference to help with the development of the mobile app.

I want the mobile app to be for iOS and Android

Your probably thinking why I picked Cocos? Well my game is similar to Agar.io and I saw that their mobile app uses Cocos2D and it runs great so I also want to use Coco’s after seeing how good it is.

Budget is $1000

Posts: 1

Participants: 1

Read full topic

Avoid black borders when using both fit height and width

$
0
0

@Orlan wrote:

Hi all,

I am developing an app with Cocos Creator, and for my app it is important that the whole canvas is shown. Of course I can enable both fit height and fit width to achieve that, but then I am getting black borders when running the app on different screen ratios.

Is there an option where I can still show everything what is seen on the canvas, but without having black borders? I tried to place a very big background screen as very first child node of the canvas, but it isn’t shown unfortunately.

I am using v1.10.2

Best regards

Posts: 1

Participants: 1

Read full topic

3.17.1 Win10 / WinRT / UWP / Xbox templates

$
0
0

@chadwyk wrote:

Going off the work that @CrazyHappyGame and @itchy72 (Windows10 and cocos2dx-3.16) have already done adding the Win10 templates back into v3.16 and 3.17, I have now got v3.17.1 building with Win10 templates, on Xbox and UWP apps.

If anyone is curious, I uploaded the modified files here: https://github.com/chadwyk/cocos2d-x_v3.17.1_UWP_Templates

Just copy these files over your current cocos2d-x 3.17.1 installation and generate a new game project and it should create the Win10 templates. Check out the readme for a few more steps, like which version to retarget the project as, etc.

There were some bugs in overridden function definitions in CCFileUtilsWinRT.cpp and .h, that were not updated when changes were made to CCFileUtils.cpp and .h (const was missing after function definitions), as well as added win10 missing dll and lib files, and I edited project files to include new libs (uv.dll, uv.lib).

I’m not good at git / pull requests, but if someone else could test and would like to merge this in and update the changes to the main git repo, I think that would be great! I saw that some of the original changes @CrazyHappyGame made for getting win10 on v3.16 were eventually merged in, and think this would be a great addition.

The tests project currently does not compile properly.

Posts: 1

Participants: 1

Read full topic

Crash StringUtil::format on China Device (Redmi 6A, Redmi 6,Honor 7A)

$
0
0

@genix_developer wrote:

I’m facing a lot of crashes about StringUtil :: format () on China Device only.Has anyone ever encountered this problem. Need help!!!

Posts: 2

Participants: 2

Read full topic

How to dynamically load Spine animations from a server?

$
0
0

@EbiPenMan wrote:

Hello,
I’m trying to dynamically create Spine animations from code, by downloading the files from a server (remote loading, cc.loader.load to download files), I won’t be able to add these animations in my resources folder or anywhere in the project because we want to add more animations later without force updating the app on the store.
However the problem is that each file is being downloaded in different folders with different names, and apparently spine can’t find the texture atlas, cause I get this error:

Failed to load spine atlas '$s' shop.png

As you can see, it seems that the texture has no name in the json file. And then spine fails to load the atlas by giving this error the next line:
Uncaught TypeError: Cannot read property 'setFilters' of null at TextureAtlas.288.TextureAtlas.load (spine.js:4850)

Any workarounds for this?
Can you actually load spine animations dynamically?
Is there a way to put all these spine files into a single folder after downloading them so atlas can find the texture?
Any help would be appreciated. Thanks.

Here is the full code that I’m using, just in case (File addresses are fake, I save these files on our server):

    let atlas = "http://test.com/shop.atlas";
    let json = "http://test.com/shop.json";
    let texture = "http://test.com/shop.png";

    cc.loader.load([atlas, json, texture], (err, results) => {
        let data = new sp.SkeletonData();
        data.textures.push(results.getContent(texture));
        data.atlasText = results.getContent(atlas);
        data.skeletonJson = results.getContent(json);
        this.skeleton.skeletonData = data;

        this.skeleton.setAnimation(0, 'Dice_Right', true);
    });

@jare
@pandamicro
@slackmoehrle

Posts: 1

Participants: 1

Read full topic

How to fake 3d view in cocos creator

Can't read module on android devices (Cocos creator 2.0.9)

$
0
0

@nguyenpq wrote:

03-26 14:10:42.969  9649  9672 E jswrapper: ERROR: Uncaught Error: Cannot find module 'NetWork', location: src/project.dev.js:0:0
03-26 14:10:42.969  9649  9672 E jswrapper: STACK:
03-26 14:10:42.969  9649  9672 E jswrapper: [0]s@src/project.dev.js:11
03-26 14:10:42.969  9649  9672 E jswrapper: [1]s@src/project.dev.js:9
03-26 14:10:42.969  9649  9672 E jswrapper: [2]anonymous@src/project.dev.js:19
03-26 14:10:42.969  9649  9672 E jswrapper: [3]sendcancelfinding@src/project.dev.js:1763
03-26 14:10:42.969  9649  9672 E jswrapper: [4]oncancelbtn@src/project.dev.js:3073
03-26 14:10:42.969  9649  9672 E jswrapper: [5]emit@src/cocos2d-jsb.js:13420
03-26 14:10:42.969  9649  9672 E jswrapper: [6]emitevents@src/cocos2d-jsb.js:13403
03-26 14:10:42.969  9649  9672 E jswrapper: [7]_ontouchended@src/cocos2d-jsb.js:12992
03-26 14:10:42.969  9649  9672 E jswrapper: [8]174.callbacksinvoker.invoke@src/cocos2d-jsb.js:28600
03-26 14:10:42.969  9649  9672 E jswrapper: [9]_dodispatchevent@src/cocos2d-jsb.js:7845
03-26 14:10:42.969  9649  9672 E jswrapper: [10]dispatchevent@src/cocos2d-jsb.js:8495
03-26 14:10:42.969  9649  9672 E jswrapper: [11]_touchendhandler@src/cocos2d-jsb.js:7737
03-26 14:10:42.969  9649  9672 E jswrapper: [12]_ontoucheventcallback@src/cocos2d-jsb.js:19841
03-26 14:10:42.969  9649  9672 E jswrapper: [13]_dispatcheventtolisteners@src/cocos2d-jsb.js:19925
03-26 14:10:42.969  9649  9672 E jswrapper: [14]_dispatchtouchevent@src/cocos2d-jsb.js:19874
03-26 14:10:42.969  9649  9672 E jswrapper: [15]dispatchevent@src/cocos2d-jsb.js:20147
03-26 14:10:42.969  9649  9672 E jswrapper: [16]handletouchesend@src/cocos2d-jsb.js:26682
03-26 14:10:42.969  9649  9672 E jswrapper: [17]touchend@src/cocos2d-jsb.js:26913
03-26 14:10:42.969  9649  9672 E jswrapper: [18]anonymous@src/cocos2d-jsb.js:26946
03-26 14:10:42.969  9649  9672 E jswrapper: [19]dispatchevent@jsb-adapter/jsb-builtin.js:2805
03-26 14:10:42.970  9649  9672 E jswrapper: [ERROR] (D:/Documents/Matika/build/jsb-default/frameworks/cocos2d-x/cocos/scripting/js-bindings/jswrapper/v8/Object.cpp, 534): Invoking function (0xc8cfcc10) failed!`Preformatted text`

Posts: 2

Participants: 2

Read full topic


parallel calculations

$
0
0

@krevedkonet wrote:

Hi team!
Does the engine support parallelism?
I have a cycle for processing several objects in which the same commands and checks are executed.
Is there any means for paralleling in cocos? Or for android can connect OpenMP (for example) library?

Posts: 4

Participants: 2

Read full topic

Cocos-BCX Terminal is released, integrating web wallet, block monitor, DApp store, props trading platform etc

$
0
0

@Summer.Yang wrote:

Cocos-BCX has released a video of its Terminal during Blockchain Games Next on March 19th in San Francisco.

Cocos-BCX Terminal is launched on Cocos-BCX testnet already. It is a user terminal integrating a web wallet, a block monitor, a DApp store, a game props trading platform etc.

There are many unique features built within Cocos Terminal, such as:

  1. Multiple easy log-in modes for users, even for non-crypto users.
  2. A web wallet supporting balance checking and asset transfer, showing all assets value equivalent in Cocos token.
  3. Fully transparent on chain real-time statistics, including details of transactions and contracts executed by user and details of all contracts executed on Cocos chain.
  4. Wallet management with three different authority levels of the same user account.
  5. A DApp store with a number of recommended games already live or to be expected on Cocos-BCX testnet.
  6. Game asset trading platform where user can sell & buy game assets.
  7. blacksmith feature within Asset Management which allows user to create his own game assets using template.

and a lot more features….

A tutorial video has been made by our community which can guide you through the whole Cocos-BCX Terminal.

To check out the Cocos-BCX Terminal by yourself, visit http://www.easywallet.pro/ .

You are welcome to share your feedback with the core team in Cocos-BCX official discord channel.

Follow Cocos-BCX official social channels:

Website: http://www.cocosbcx.io/en/

Discord: https://discord.gg/jdJMNtC

Blog: https://medium.com/cocosbcx

Telegram: https://t.me/cocosblockchainexpedition

Twitter: https://twitter.com/cocosbcx

Reddit: https://www.reddit.com/r/cocosbcx/

Forum: https://discuss.cocos2d-x.org/c/cocos-bcx

Key Words:

Posts: 1

Participants: 1

Read full topic

Window resize event

$
0
0

@SteinOveHelset wrote:

Hi,
If I open my game on a Chromebook or ARC Welder in Chrome I get the possibility to resize the window. The scene it self is still the same size, but the window will be too big (Black borders) and the touch coordinates is off.

Is there a way to detect when this happens so things can be scaled/reset or something?

Posts: 2

Participants: 2

Read full topic

How to change the real resoluton ratio of the game window by javascript code ?

$
0
0

@xieal wrote:

I wanna give the players some choices of resolution ratio (eg, 1024 * 768, 1600 * 900, 1920 * 1080) and the real window resoluton ratio would automaticlly change after the players choose one.

Posts: 1

Participants: 1

Read full topic

mask displayed in rendertexture will be white.

Viewing all 17090 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>