3

I'm new to CraftyJS and was wondering if anybody has had this problem.

I want a game canvas that is located inside a div. I was wondering how to do this.

Crafty.init({...})
Crafty.canvas();

Doesn't give me the desired results.

It simply puts the canvas at the bottom of the page.

atreat
  • 4,243
  • 1
  • 30
  • 34

1 Answers1

3

Just set the id of the div to "cr-stage". That should do the trick.

Oh, and welcome to the Crafty community. Hope you enjoy it :-)

btw. I only stumble upon Crafty questions on SO by chance. If you want to be sure to get an answer you should use our google group https://groups.google.com/forum/?fromgroups#!forum/craftyjs

bbtw. It looks like you are using an older version of Crafty (We have changed the canvas initialization to Crafty.canvas.init()) I would advise you to upgrade before you continue with your game. There are a few breaking changes, ask in the forum.

sorenbs
  • 749
  • 4
  • 7
  • Thanks a lot. I noticed that Crafty had been changed. I'll definitely get on that forum too. – atreat Feb 29 '12 at 15:08