Questions tagged [craftyjs]

Crafty is an HTML5 game engine written in JavaScript which helps you create games in a structured way. Its core features include Entities & Components, being able to use Canvas, DOM, WebGL and Event binding.

Crafty is an HTML5 game engine written in JavaScript which helps you create games in a structured way. Its core features include:

  • Entities & Components - A clean and decoupled way to organize game elements. No inheritance is needed!
  • Canvas or DOM - Choose the technology to render your entities, it will look exactly the same.
  • Eventbinding - Event system for custom events that can be triggered whenever, whatever and bound just as easy.

For more information, see http://craftyjs.com.

105 questions
20
votes
4 answers

Crafty.js Tutorial

This question has probably been asked before, but I didn't find it while searching. Can anybody point me towards a good up to date tutorial for Crafty.js? I cannot seem to find one and I am having trouble getting my head around it. If there are no…
starbeamrainbowlabs
  • 5,692
  • 8
  • 42
  • 73
4
votes
1 answer

How to use multiline sprite sheet in Craftyjs without specifying frames manually

I've just started out using craftyjs and am running into a problem. I have a sprite sheet that has two rows for the same animation. Top row has 4, bottom has 3. I can't figure out how to get it to play through all 7 images. I can get it to play…
marklar
  • 41
  • 1
4
votes
1 answer

Multidimensional Array problems

I've been trying to fix this for about 3 days now, and I can't seem to find why it doesn't work. I've got this function, which loads an image, and loads through all the pixels to create a grid of walls for A* pathfinding. I'm using CraftyJS to…
Sem Wong
  • 78
  • 6
4
votes
2 answers

Javascript Game Development equivalent of Pygame.org?

I am starting to learn and develop games in Javascript. I was just wondering if there are websites for Javascript game development analogous to http://pygame.org/news.html. Pygame/Python was the first language I learned how to develop games on, and…
Josh
  • 1,032
  • 2
  • 12
  • 24
4
votes
1 answer

Getting the component type from a object in craftyjs

Let's say I have a code like the following. Crafty.c("SomeType",{//do something... }); var obj=Crafty.e("SomeType"); Can anyone tell me whether there is a function to check the type of the object? Ex:…
Sanka Darshana
  • 1,391
  • 1
  • 23
  • 41
3
votes
1 answer

How can I render a Crafty JS canvas into a div I created in HTML?

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…
atreat
  • 4,243
  • 1
  • 30
  • 34
3
votes
0 answers

CraftyJS ignores polygon onHit

i've some problems with craftyjs, collision and polygons. Here is my code: http://jsfiddle.net/haenx/85mhj/ As you can see, the player will hit the enemy each time both boxes are overlapping. But the given polygon has another form and it semms it…
danbruegge
  • 2,104
  • 3
  • 20
  • 27
3
votes
1 answer

Redirect to URL from CoffeeScript

I'm trying to add a button to an app that uses Crafty, but, unlike the other buttons, I want this one to redirect the user to a different URL. Notice that no-one ever taught me how to use Coffee or JavaScript, so I'm really new. I'm trying to use…
Sascuash
  • 3,661
  • 10
  • 46
  • 65
3
votes
2 answers

socket.io data seems to be sent multiple times(nodejs and craftyjs)

I am following this tutorial on making HTML5 games. I wanted to try and mix node in to make it multiplayer. I am using node.js(v0.10.4) on server and crafty.js on front end. I am using socket.io to send and receive messages. For now it's just me(not…
3
votes
3 answers

How to make an animated sprite move with mouse interaction using Craftyjs?

I have a HTML5 canvas game that I have written using Craftyjs. I have keyboard interaction working fine using the arrow keys but I'm having problems adding mouse interaction. The sprite does move slightly with the mouse, but not the same way as it…
Rich Gray
  • 191
  • 2
  • 11
3
votes
2 answers

Scene size with CraftyJS on iOS device

I'm trying to make a CraftyJS scene size 100x100 pixels to display exactly as 100x100 pixels in mobile Safari on iOS. The code is essentially this: function init() { // Start crafty Crafty.init(100,…
Coder12345
  • 3,431
  • 3
  • 33
  • 73
2
votes
2 answers

How to do a Tween in CraftyJS?

Alright, I'm at my wits end and I can't get CraftyJS to do a tween. So what I wanna do is, everytime a Mushroom gets hit, I want to check if that mushroom has the component "Answer". If it exists, I will do nothing. Otherwise, I wanna display a big…
Deyang
  • 510
  • 6
  • 20
2
votes
1 answer

TypeError: Crafty.scene is not a function

I have a small problem. I'm developing a game using CraftyJS and I need to use Electron to run it, but Electron throws this error: Uncaught TypeError: Crafty.scene is not a function at Level1.js:4 Why does it do this? Here's the relevant code +…
2
votes
1 answer

How can I apply gravity on multiple CraftyJS components?

I have three components, Ground, Block, and Player. I want player to stop falling when coming in contact with both Ground and Block entities. I have tried this.gravity("Ground, Block"); and this.gravity("Ground", "Block"); but the former disables…
Jordan Baron
  • 3,752
  • 4
  • 15
  • 26
2
votes
1 answer

Why is this basic Canvas animation not smooth?

The only thing that I do inside the animation loop is update the x and y coordinates but the circle is still not moving as smoothly as it should. This is the fiddle. I am using CraftyJS to animate the circle. Here is the code that does the…
Neena Vivek
  • 667
  • 7
  • 19
1
2 3 4 5 6 7