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

Got lost inside the Tank Battle tutorial

$
0
0

I am a newbie trying to go through tutorials to get an idea how to create different types of games. I got through Part One of the Tank Battle tutorial just fine. At the beginning of Part Two, a Start page magically appears. There are no instructions how to create this page. So I created my own. I have it looking the same, but it is not responding to the scripts. I made sure that I am using the same Node names. Nothing happens when I press the Play button. Obviously, I did not create it correctly. I re-read the documentation. I started the tutorial again from the beginning. I found nothing useful to help me understand what I am doing wrong.

Any help will be greatly appreciated. What I am looking for is clear instructions how to create the start page.

1 post - 1 participant

Read full topic


WebGL 3D Load Speed Tests

$
0
0

Has anyone done any comparisons or tests of 3d models load speed using Cocos?

I’m interested to know the kind of time it takes to stream in models from the web and view them in Cocos.

The Sketchfab player seems to stream in stuff quite quickly and Playcanvas is the fastest I’ve seen (Unity and Unreal being the worst) but is Cocos WebGL load speed comparable to any of these?

Thanks

1 post - 1 participant

Read full topic

Creator 2.4.2 IOS Native build performance issues

$
0
0

We compare web build game performance and IOS native build. In IOS native build there are many freezes and low fps. However, there are no such issues in web build running on the same device as well as Android native build. What could we do to fix this problem?

1 post - 1 participant

Read full topic

SDKBOX Firebase AppMeasurementService not registered/enabled

$
0
0

Hello
I am integrating sdkbox firebase to cocos2dx v3.3 lua game
I created new project and did all steps from http://docs.sdkbox.com/en/plugins/firebase/v3-lua/

But I am getting logcat

09-21 19:17:25.297 E/FA      (12846): AppMeasurementService not registered/enabled
09-21 19:17:25.298 E/FA      (12846): Uploading is not possible. App measurement disabled

Below is full logcat

09-21 19:17:25.162 V/FA      (12846): Registered activity lifecycle callback
09-21 19:17:25.208 V/FA      (12846): Cancelling job. JobID: 1793668389
09-21 19:17:25.272 V/FA      (12846): Collection enabled
09-21 19:17:25.272 V/FA      (12846): App package, google app id: test.game.com, 1:700757031408:android:9453103ce0cb4893478535
09-21 19:17:25.274 I/FA      (12846): App measurement is starting up, version: 12211
09-21 19:17:25.274 I/FA      (12846): To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
09-21 19:17:25.275 I/FA      (12846): Faster debug mode event logging enabled. To disable, run:
09-21 19:17:25.275 I/FA      (12846):   adb shell setprop debug.firebase.analytics.app .none.
09-21 19:17:25.275 D/FA      (12846): Debug-level message logging enabled
09-21 19:17:25.278 V/FA      (12846): Persisting first open: 1600705045134
09-21 19:17:25.297 E/FA      (12846): AppMeasurementService not registered/enabled
09-21 19:17:25.298 E/FA      (12846): Uploading is not possible. App measurement disabled
09-21 19:17:25.298 D/FA      (12846): Setting app measurement enabled (FE): true
09-21 19:17:25.299 V/FA      (12846): Setting measurementEnabled: true
09-21 19:17:25.330 W/FA      (12846): Failed to retrieve Firebase Instance Id
09-21 19:17:25.337 V/FA      (12846): Checking service availability
09-21 19:17:25.343 V/FA      (12846): Service available
09-21 19:17:25.344 V/FA      (12846): Setting useService: true
09-21 19:17:25.350 V/FA      (12846): Connecting to remote service
09-21 19:17:25.393 I/FA      (12846): Tag Manager is not found and thus will not be used
09-21 19:17:25.404 D/FA      (12846): Connected to remote service
09-21 19:17:25.404 V/FA      (12846): Processing queued up service tasks: 1

Below is full project code of mine.

I am struggling for 5 days for this issue, but still can’t find why…
Can anyone take a look and help me please?
@yinjimmy could you please take a look for me ?
Many thank you

3 posts - 2 participants

Read full topic

cc.randomRangeInt() is undefined

$
0
0

Hi.

I am new to Cocos, Cocos Creator and TypeScript. I have a script attached to a sprite node and I am trying to generate a random number when the node is created using the cc.randomRange and cc.randomRangeInt methods. But whatever I try, it is return undefined and in the console I also get an error saying cc.randomRangeInt is not a function.
I tried searching the docs, but it doesn’t actually provide any explanation how to use these methods in practice. Maybe it is common sense but atm I am a total beginner and I have node idea.

This is what I`m trying to do:

@ccclass
export default class NewClass extends cc.Component {

    public randomNumber:number
    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.randomNumber = cc.randomRangeInt(0,4);
    }

    start () {
        alert(this.randomNumber);
    }

    update (dt) {
        
    }
}

When I run this, it is alert the value ‘undefined’ and write to the console cc.randomRangeInt is not a function. The reason I do this is because I would like to use the random value in the start() callback function when the node is created. I tried generating the random value all over the place but I always get the same result.

Could anyone please help me and explaining what am I doing wrong or direct me to any article or section of the documentation that could help me?

Thank you.

2 posts - 2 participants

Read full topic

Bugs associated with the new iOS 14 feature "Scribble"

$
0
0

Cocos2dx 3.17.2
iOS14 + iPad Pro + Apple Pencil

I found the Apple Pencil scribble working with an app using cocos2dx.
This is happening in all cocos2dx apps.
The solution is to turn off “scribble” from the settings app.
Is there a way to solve it from my app?

7 posts - 2 participants

Read full topic

Hot update file name mismatch

$
0
0

@pandamicro , @Randomzord ,
i am trying to implement hot update in my project and i had a question…in res/src folder the file names have a code in them before .js (for eg. settings.a9e57.js) and this code is different in each build. how then can we update these files where we use the new file and delete the old one?
also, in the actual build the file extension is .jsc and the remote-assets will have file extension .js. Can a .js replace a .jsc?
thank you!

2 posts - 2 participants

Read full topic

Problem with Scale9 sprites and logical resolution

$
0
0

There is a problem with scale9 sprites and logical xN resolution. Imagine I have a 30x30 pixels sprite that I would like to use as scale9 sprite with 10 pixel margins from all sides. I lay everything out in 1x resolution, which results in 4 corner images of 10x10 pixels which won’t be scaled in any direction.

Now for x2 and x3 resolutions I assumed I will simply create 60x60 and 90x90 versions of the image, like I do with regular images, and will use 20 and 30 pixel margins for them correspondingly. Unfortunately, that doesn’t seem to work: when cocos finds my x3 version of the image, it doesn’t scale down 30x30 corners to fit them into 10x10 points of the x1 design resolution - it keeps them as 30x30, which consequentially makes the smallest corner side it can do - 30x30. The alternative, of course, would be not to have x2 and x3 versions of the sprite at all and only use x1 version, however, that means I will have to use lower resolution corners on higher resolution devices:

x-x
|#|               - x1 resolution
x-x

xxx---xxx
xxx---xxx
xxx---xxx
|||###|||
|||###|||         - x3 resolution
|||###|||
xxx---xxx
xxx---xxx
xxx---xxx

Parts represented by x don’t scale in any direction by scale9 processing, however, there are 9 times more pixels on x3 in their spot than there is on the design resolution x1.

How can I provide a higher resolution equivalents of the scale9 images that would still behave correctly with respect to the x1 design resolution?

Thank you!

1 post - 1 participant

Read full topic


New User- Typescript or Javascript

$
0
0

What’s the best/recommended scripting language to use with Cocos; Typescript or Javascript?

What are the main differences? (I’m looking for the easiest/fastest to implement.) or does mixing them up have some benefit?

I noticed that with Javascript there are some discrepancies in tutorials; for example the following function declarations both can be used

eg:
onLoad () {},
//or
onLoad:function(){},

…and so sometimes it all seems like guesswork which one to use (different ways to write the same thing). Is typescript any more consistent?

Thanks

1 post - 1 participant

Read full topic

I'm having trouble compiling in Visual Studio

$
0
0

We have a released project under iOS and Android and we are considering releasing a version on Windows. This is from Cocos V3. I opened it up in Visual Studio 2019 for the first time and it said it needed to update the project. I allowed it to do so as it couldn’t compile otherwise. I try to compile it now and I get all sorts of errors in the Cocos engine when compiling. As I have not edited the engine, I am assuming its because I do not have the project configured right. Here is a small sample of the errors I am getting

expected a ‘{’ C:\Users\holtk\Documents\GitHub\igun-pro-2-client-cpp\cocos2d\cocos\base\CCConsole.h 62

void CC_DLL log(const char * format, ...) CC_FORMAT_PRINTF(1, 2);

|Error|C2039|‘function’: is not a member of ‘std’ (compiling source file …\audio\win32\AudioCache.cpp)

void addPlayCallback(const std::function<void()>& callback);

There are 126 errors, but I was hoping this might give a hint as to what is going wrong. I’ve installed the “Universal Windows Platform Development” as was suggested in an article on the internet for this type of error, but it didn’t help. Any additional help would be appreciated!

Thanks!
David

2 posts - 2 participants

Read full topic

Debugging Best Practice?

$
0
0

New user here. What’s the best best practice for debugging with Cocos creator?

I can see console logs (in the browser and simulator) but I’d really like to be able to watch certain variables in realtime. I tried setting some watch variables up in Visual Studio Code but its very cumbersome.

It doesn’t show the variables until you pause it using a breakpoint and the variable scope is a bit strange to comprehend. For example watching this.someVariable…what is the scope of this when debugging??

Any tips would be gratefully received. Thanks.

2 posts - 2 participants

Read full topic

help me create a basic clicker game to start learning Cocos Creator

$
0
0

Hi everyone!

I’m just beginning with Cocos Creator and I struggle to understand the engine.
I’d like to create a very basic game with no physics (as opposed to the documentation first project tutorial) to start getting the hang of things. So I want to make a very basic clicker game.

I’ll try to build it with your help. I’ll be describing my process in very precise details in order to help others understand the engine as well.

Here is what I did so far:

  • First, I created an empty project from the dashboard.
  • I wanted to change the game resolution of the project so I selected the Canvas node in the Node Tree panel to change the Design Resolution properties to 320x180 of the Canvas component in the Properties panel. It seems that the Size properties of the Node is locked and I don’t know if the Design Resolution properties are the good way of changing the game resolution. Am I doing it right or is there another way to control that?
  • Next, I added an image file 32x32 (png format) inside the assets folder.
  • Since I wanted a pixel art style, I selected the image asset in the Assets panel to show its properties in the Property panel. I changed the Filter Mode property to Point.
  • I dragged the image asset from the Assets panel inside the scene editor to create a Node with a Sprite component assigned to that image.
  • I wanted the sprite to appear at a random position inside the canvas. I guessed I had to create a script asset and then attach it as a component to the sprite node. Then I would use the start method to set the position of the sprite at the time of its creation with some random function.

So I created a JavaScript script asset and I changed the start method as such:

start () {
        this.node.x = Math.floor(Math.random() * 320);
        this.node.y = Math.floor(Math.random() * 180);
    }

After selecting the sprite node and adding the script as a new component to it with the Add Component button and choosing Custom Component -> my_script_name I clicked the triangle Play button multiple times to see if the image would change its position each time. It seemed to work properly. However, as you can see, I don’t know how to get by code the canvas resolution So this is my first issue.

How can I get the canvas resolution by code?

1 post - 1 participant

Read full topic

Label is cutting the text characters (The very first and very last))

$
0
0

Hello! I’m having a little trouble with the label text. It only happens when the text is small, but the label cuts a little of the final character. Here:

label2

Now, this is what happens when I add a space at the end and start of the string:

label3

Is it possible to fix it without using an extra space?

1 post - 1 participant

Read full topic

Does anybody can provide an example or a tutorial, how to use download pipelines?

$
0
0

Hello all devs, i would appreciate your help to provide any example or tutorial - how to use download pipelines?

Thank you!

2 posts - 2 participants

Read full topic

addChild by not changing the position

$
0
0

I am new to Cocos2d-x so if this is beginner stuff, I’m sorry :frowning:

Is there any function that can do exactly that?
And is there a way to do this in 3D(setPosition3D)?

Thanks for reading!

1 post - 1 participant

Read full topic


Rotate Sprite3D using another Sprite3D as Anchor Point

$
0
0

Screen Shot 2020-09-23 at 6.34.29 PM

I want to rotate the 8 cubes using the center red cube. (The top surface.) Just like a Rubik’s cube. But how do I do it? (The center red cube doesn’t have to rotate)

  • I tried adding the 8 cubes as a child to the center red cube. But if I addChild, the 8 cubes position changes, and I don’t want that.

Sorry for my bad English :frowning:

2 posts - 2 participants

Read full topic

How to change the Launch Screen Image

$
0
0

I made a project with cocos2d-x v4.0.
I changed proj.ios_mac/ios/LaunchScreenBackground.png to a black image.
I cleaned the project and then built it.
However, when I ran it on my iPhone, the cocos2d-x logo was displayed.
I don’t understand why I can’t change the Launch image.
How can I change it?

1 post - 1 participant

Read full topic

sdkbox.PluginFacebook not visible cocos creator

$
0
0

I tried to integrate facebook through sdk box but sdkbox.PluginFacebook is not visible in the project. I had successfully integrated firebase and sdkbox.PluginFirebase working fine. Both #include "PluginFacebookJS.hpp" #include "PluginFacebookJSHelper.h" are present in appdelegate.cpp and se->addRegisterCallback(register_all_PluginFacebookJS); se->addRegisterCallback(register_all_PluginFacebookJS_helper); are also there. What else I might be missing here?

1 post - 1 participant

Read full topic

Missing assets folder in apk after upgrading Gradle

$
0
0

Hi. I’m using Cocos2d (js) 3.16 with deprecated Cocos Studio (I know it’s bad).
I need to build AAB (android application binary) so I had to upgrade gradle (Android Studio says it’s required to assemble AAB).
I’ve been fixing all gradle migration issues and now there is only one left to resolve.
For some reason final APK file doesn’t contains assets folder.
I tried a lot of recipies found in google but none of them helped.
Can anyone help me?

I can see that assets are copied to app/build/intermediates, then Compile JS stage also completes successfully.

1 post - 1 participant

Read full topic

randomRange() never return the maximum value of range

$
0
0

Hi.

I am trying to generate a random value in range 0.00 and 0.09 using the cc.math.randomRange() method. However, for some reason, the value the method return, never go above 0.06, I need to set the maximum value to 0.15 to force it to go up to 0.09. But obviously it is not optimal as if the method return any value above 0.09, it would be invalid in my app.

Not sure why is this happening. is there any better solution to this?

Thank you.

1 post - 1 participant

Read full topic

Viewing all 17068 articles
Browse latest View live


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