I am a newbie, in crafty as well as js, so pardon me if I might have made very silly errors in the following program.
What is wrong with the following code? The following code is supposed to create 5*5 matrix where each block would be a 60 pixel high and wide iceblock as stored in iceblock.jpg.

        Crafty.sprite(60,"iceblock.jpg",{block : [0,0]});
            init: function(){
                this.addComponent("2D, Canvas, Mouse, block");
                this.w = 60;
                this.h = 60;

    for(var i=0;i<5;i++)
            for(var j=0;j<5;j++)
                Crafty.e("iceblock").attr({x: i*60,y: j*60})

The corresponding HTML code is:-

<!DOCTYPE html>
    <script type="text/javascript" src="crafty.js"></script>
    <script type="text/javascript" src="assignment.js"></script>
    <title>My Crafty Game</title>


When I open the HTML page, the complete output page is blank.
This is the link to the image.

Nevr mind... found the solution. Thnaks anyways.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.