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
1
vote
1 answer

Basic Crafty Game fills up entire screen on mobile devices

I am trying out Crafty.js to do some basic games and it works perfectly on desktop browsers but fills up the entire screen on mobile devices. Here my webpage: Game
How do I make it so that the JavaScript is…
1
vote
1 answer

Craftyjs animation not changing properly

I'm using http://craftyjs.com/ for the Github Game Off, and I'm having some trouble with animation. The first time I start the animation (when I initialize the player entity in the main scene) it works. But when I set the animation via my…
RylandAlmanza
  • 1,358
  • 1
  • 8
  • 14
1
vote
1 answer

Horizontal Collision Detection Using Crafty.js Game Engine

I'm trying to build a breakout-style type of game with continuous vertical player movement and only horizontal input. I need to detect if a brick is hit on the sides or top/bottom. Without detecting that, I haven't been able to stop the player…
Marc Ripley
  • 813
  • 1
  • 6
  • 19
0
votes
0 answers

centering an entity in Crafty.js?

I'm trying to center an entity, but I want it to be center no matter the window configuration.(I'm relatively new to JavaScript and Crafty.js in general, so there might be a really easy fix I'm not seeing.) I've tried creating a variable and…
Luke K
  • 1
  • 3
0
votes
1 answer

How to fit the viewport centered to the scene in CraftyJS?

I'd like to show the whole scene (static size) and center it, i.e. I have to zoom/scale and move the viewport according to the window size. Depending on the aspect ratio, I scale either to fit the width or the height. Then I centerOn the scene const…
maiermic
  • 4,764
  • 6
  • 38
  • 77
0
votes
1 answer

Crafty help- text will not stop wrapping in Javascript

I have spent hours reading and trying solutions to other people's wrapping problems and nothing is working. I am using Crafty to build a game and want to display one line of instructions but no matter how I style the text it keeps wrapping at every…
0
votes
1 answer

Crafty.js looping after upgrade to 0.4.1

I don't know if Crafty.js is popular on Stack Overflow yet or not, but I've been using it, and I didn't get an answer from the mailing list, so I figured I'd try here. I have some code that worked fine under release 0.3.x, but when I upgraded to…
Gordon Seidoh Worley
  • 7,839
  • 6
  • 45
  • 82
0
votes
1 answer

Crafty.js Go back to previous position after Collision

player.bind('Move', function(from) { if(this.hit('Tree')){ player.x = from._x player.y = from._y // Here player.x…
0
votes
1 answer

Custom Components in Crafty.js

I am new to Crafty.js. I am currently working a 2D Top Down RPG using this frame work. I am trying to create a custom component that will contain the Unit's information such as Health, Mana, Name etc. My component's code are as…
Ely
  • 11
  • 4
0
votes
1 answer

vue.js - craftyjs click does not work

I have the following code yet nothing happens. Crafty.e('2D, Canvas, Color, Mouse') .attr({x: 10, y: 10, w: 40, h: 40}) .color('orange') .bind('Click', function(e){ alert('clicked', MouseEvent); …
A. L
  • 11,695
  • 23
  • 85
  • 163
0
votes
1 answer

craftyjs viewport misunderstanding

Learning CraftyJS and I'm missing some info about how does viewports work. What I need: large horizontal map (platformer) and camera, following the hero. Is there any hints where to read detailed information, explaining how does it work? Thanks a…
HungryCat
  • 33
  • 5
0
votes
1 answer

How to check whether a craftyjs entity has fallen out of crafty area?