I am building a tap on-time game I need mechanics for it
-
use some sort of timer to decide if the player has touched what you want in the time they needed to touch it in.
-
repeat
-
perhaps there are many objects for them to touch all at once or very quickly. Use a manager class to track each object.
-
Perhaps there is physics involved?
yes, I am trying to apply different sprites according to red-yellow-green color when tap correctly the sprites will appear I need any kind of reference. you know I am quite new to the coding of javascript
Please review our getting started guide. https://docs.cocos2d-x.org/creator/manual/en/getting-started/
examples-cases-master has the solutions !!!
const {ccclass, property} = cc._decorator;
@ccclass
export default class xmover extends cc.Component {
@property
speed : number = 10;
update (dt)
{
this.node.x -= this.speed * dt;
if (this.node.x < -2*(this.node.width*2) - this.node.width/2)
{
this.node.setPosition((this.node.parent.width/2 + this.node.width/2.5), 0,);
}
}
}