Skip to main content
2 of 2
Code formatting
DMGregory
  • 140.8k
  • 23
  • 257
  • 401

Javascript-How to create a moving bullet animation from canvas

the bullet cant see to move at all

function bullet() {
    this.x=playerx;
    this.y=playery;
    this.init=function(){
        this.x+=5;
        draw(this.x,this.y,10,10,"blue");
        console.log(this.x)
    }
}

in another function

if(k.keyCode==17){
    bullets=new bullet();
    bullets.init();
}