Jump to content

this.add.line is not a function


yassinius
 Share

Recommended Posts

Guys, I'm stuck, I just want to draw a simple line using the following code:

function create ()
{
    this.add.image(400, 300, 'bg');

    var r1 = this.add.line(200, 200, 0, 0, 140, 0, 0x6666ff);

    var r2 = this.add.line(400, 200, 0, 0, 140, 0, 0x9966ff);

    //  WebGL only
    r2.setLineWidth(10, 40);

    var r3 = this.add.line(600, 200, 0, 0, 140, 0, 0x1a65ac);

    //  WebGL only
    r3.setLineWidth(1, 16);

    var r4 = this.add.line(200, 400, 0, 0, 140, 0, 0xff6699);

    var r5 = this.add.line(400, 400, 0, 0, 140, 0, 0xff33cc);

    var r6 = this.add.line(600, 400, 0, 0, 140, 0, 0xff66ff);

But when I try to run the code, this is what I get:this.add.line is not a function, but It should be a function in Phaser 3. I'm using Phaser v3.11 right now. What else can I use to draw simple lines? I took this straight out of an example on the phaser website. http://labs.phaser.io/edit.html?src=src\game objects\shapes\line.js

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...