What is this. unhandled error?


#1

what is" unhandled error:typeError:object#has no method‘trunc’"

i met this error when i am trying to understand the code below…

var twoPi = 2 * Math.PI;
this.setFlowerColor("red");

this.drawPolyStars = function(center, radius, sides, skips, startAngle) {
    this.toggleFlowers(false);
    var angle = startAngle;
    var x = center.x;
    var y = center.y;
    var hoops = skips + 1;
    var stepAngle = hoops * (twoPi / sides);
    if(skips !== 0 && (sides % hoops) === 0) {
        hoops = skips;
    }
    var endAngle = (twoPi * hoops) + startAngle;
    while(angle <= endAngle) {
        var newX = x + radius * Math.cos(angle);
        var newY = y + radius * Math.sin(angle);
        this.moveXY(newX, newY);
        this.toggleFlowers(true);
        angle += stepAngle;
    }
};
var RedX={x:28,y:36};
this.drawPolyStars(RedX, 10, 6, 16, 30);

#2

Your code runs fine for me. Do you have the Ring of flowers equipped?


#3

thanks for replying me …

this is
what my hero is wearing …

this is the error


#4

Is there any chance you’d have accidentally erased part of the default code? You can try clicking the “Reload” button in the top-right of the code editor which resets the level’s code to its initial state.

If that doesn’t work, please post your full code.