Saturday, June 4, 2022
HomeGame DevelopmentDidn't get the default worth of velocity in school "newclass" - Code...

Didn’t get the default worth of velocity in school “newclass” – Code IDE


i used to be following a tutorial i comply with it like a guide and that i bought an error which i do not know what might have trigger it
it says:
Didn’t get default worth of “velocity” in school “NewClass”. If utilizing TypeScript, you additionally have to cross within the “default” attribute required by the “property” decorator.

the code i used:

const {ccclass, property} = cc._decorator;

@ccclass
export default class NewClass extends cc.Part {

@property
velocity: quantity = 10 ;

     onLoad () {

     }

    begin () {

    }

     replace (dt) {
         this.node.setPosition(this.node.place.x+this.velocity*dt,this.node.place.y);
        if(this.node.place.x>this.node.dad or mum.width)
        {
            this.node.setPosition(0,this.node.place.y);
        }


         
     }
}

not solely that however i’m additionally unable to set the worth in cocos creator because it ought to
it ought to seem a field the place i set the worth for every particular person zombies however the field isn’t even there.

please clarify me why i bought this error, what might have triggered it and easy methods to repair it.
Thanks!!


I attempted your code in 2.4.9 and it didn’t report you this error. Beneath what circumstances do you report the error?

Hello, if the issue is solved, please reply.

i up to date to three.5.1 and wrote the properties with totally different approach and it labored
i wrote em as:

@property({sort:Quantity})

public velocity: quantity = 10;

it may be closed now…

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments