@luke2125 wrote:
Hi,
Please look at the below code:
BulletRight:function(){
var bulletright = cc.instantiate(this.footballbulletright);
footballbulletright.setPositionX(this.posx);
footballbulletright.setPositionY(this.posy);
this.node.addChild(bulletright);
}
PlayerPositionXY:function(){
var posx = this.node.getPositionX();
var posy = this.node.getPositionY();
cc.log(posx,posy);
}Now, what I'm trying to accomplish is that the bullet be constrain to the player, when I press spacebar to shoot bullet, I would like it to appear on the player or at least x+50 pixels to the right of the player and be constrain to the player, wherever that player moves around the screen, the bullet will spawn close to the player......Would appreciate any feedback........Thanks and God Bless....
Sincerely,
Sunday
Posts: 1
Participants: 1