"JavaScript (sometimes abbreviated JS) is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles." From Wikipedia. ...

learn more… | top users | synonyms

7
votes
3answers
3k views

Poor performance in android when running APK, runs fine in browser

I have created a small game project in HTML5 using Phaser engine (tried both 1.1.5 and 1.1.6). Then to port it to mobile platform, used Phonegap/Cordova for Windows Phone 8, Android and iOS. In my ...
3
votes
1answer
59 views

Confused about Max Vertex Uniform Vector limit

While coding my WebGL app I've encountered an interesting phenomena: On my first PC (with GPU Radeon HD 5850), BrowserLeaks (link) tells me that in my browser - Google Chrome Version 36.0.1985.143m ...
2
votes
1answer
153 views

Three.js camera turning leftside right

In Three.js I am trying to implement an orbiting camera can be rotated around the x and the y axis. I am using these two functions: function rotateX(rot) { var x = camera.position.x, ...
1
vote
1answer
51 views

Unity Raycast shoots right through some objects

I made a melee combat system for my game. The code looks like this: var hit:RaycastHit; if(Physics.Raycast(transform.position,transform.forward,hit)) { if(hit.distance<=2.0) { ...
0
votes
1answer
32 views

Align SpriteText position

i have this function which aligns text. static function AlignTxt(obj : GameObject, txtAnchor : SpriteText.Anchor_Pos, txtAlign : SpriteText.Alignment_Type) { ...
-1
votes
1answer
600 views

Framework to build scrollable map with item selection in JavaScript?

I need a mobile device to be able to scroll a large, static map image, and also be able to select PNG image "objects", like this: What would be the simplest method? HTML5, jQuery, Sencha Touch, or ...
1
vote
0answers
46 views

How can I mimic an isometric perspective using square tiles?

Can an isometric perspective be mimicked with traditional square tiles? Can't the effects of the 45-degree overhead view simply be "drawn in" to the square? How would this work? Picture this: the ...
1
vote
0answers
66 views

Shadows in html5 canvas game

I'd like to ask for reference. I met an article about how to cast shadows in games. I'm using html5 canvas (currently without webgl) with javascript for my projects. The article mentioned above is ...
1
vote
0answers
107 views

Creating Top-Down Race Track From A List Of 2D Points

My final year project for university is based on the idea that a two-dimensional top-down multiplayer racing game can be made using Google Maps to dynamically generate race tracks. The idea is that ...
1
vote
0answers
24 views

p2.js physics engine behavior on Heightfield

I am writing a small game consisting of a 'ragdoll' character riding a skateboard. I have created a 'skateboard park' with some ramps and a jump. I am using a 'heightfield' object as the ground. ...
1
vote
0answers
49 views

Algorithms for positioning rectangles evenly spaced with unknown connecting lines

I'm new to game development, but I'm trying to figure out a good algorithm for positioning rectangles (of any width and height) in a given surface area, and connecting them with any variation of ...
1
vote
0answers
36 views

Moving a div with hotkeys using easing in and out

I'm working on replicating Tagpro using AngularJS and Firebase as a learning project. I want this ball to move using ease in and out like in the youtube video below. My code: ...
1
vote
0answers
42 views

Maintaining relative location of objects across different screen resolutions

I'm developing a very simple interactive HTML5 game, in which I need to show a room having multiple objects like cupboard, table, fan etc. How can I bind all of the objects together, so that they ...
1
vote
0answers
135 views

How to integrate Javascript into C# and run scriptcode step by step

We are currently working on a Pokemon MMO trying to figure out how to implement an asynchronous scripting language the best. We don't want to work with threads or tasks, but the goal was to wait for ...
1
vote
0answers
123 views

Is there an out-of-the-box way to create a custom non-convex polygon in three.js?

Does Three.js offer an out-of-the-box way to create custom non-convex polygon, or do I have to use THREE.Geometry and set faces manually? I'm guessing that ShapeGeometry has something to do with this, ...
1
vote
0answers
477 views

shader-based particle systems

I have a classic particle system where each particle is represented by a quad and, each time step, I move each particle. My target is webGL which means I don't have instancing, attribute divisors nor ...
1
vote
0answers
760 views

How to turn a 3d camera (in HTML5 2D Canvas)

A few years back I started experimenting with 3d in canvas. Everything went pretty well untill I had to to turn the camera, I couldn't get it done. A few days back I just happened to stumble upon ...
0
votes
0answers
12 views

cocos2d-js displays only one type of tile from a tmx file

I am using Tiled to produce a tmx which I use in my code using cocos2d-js. The problem is that when I run it on the browser, a wrong tile gets displayed, the first one of the image (0,0) and repeats ...
0
votes
0answers
25 views

Processing.js for loop not executing all the way

I'm trying to add elements to an ArrayList (in Processing.js, basically a javascript array) in a for loop. BEcause of the many objects I need to add, the for loop is not incrementing all the way ...
0
votes
0answers
48 views

Balancing fight script in Text Based Javascript Game

I'm working on a little text based javascript game and I've been using chromes Javascript console for the output. The 'game' works off a series of methods written into an object called Player created ...
0
votes
0answers
19 views

Crafty Bind “createView” to viewport - TiledMapBuilder

Is there any way to bind the createView function to the player entity? For Example: I am moving forward and the map is automatically loaded. I call the Map with: Crafty.e("2D, DOM, ...
0
votes
0answers
22 views

changing sprite coordinate when defining a new reel in crafty.js

this is my jsfiddle : http://jsfiddle.net/B5UsC/18/ this.bind('KeyDown', function () { if (this.isDown('A')) { this.__coord[0] = 57; ...
0
votes
0answers
29 views

Box2D.js b2ChainShape

I'm using box2d.js (asm.js ported) and need to create a b2ChainShape. var bodyDef = new Box2D.b2BodyDef(); var fixDef = new Box2D.b2FixtureDef(); bodyDef.set_type(Box2D.b2_staticBody); var chain = ...
0
votes
0answers
64 views

Drawing a object with Box2D and HTML5 canvas on current mouse position

I'm attempting to create a air hockey type game with HTML5 canvas and JavaScript, using Box2dWeb for the physics calculation. I need a way to draw the puck at the current mouse x and y position every ...
0
votes
0answers
35 views

Calculating co-ordinates of a line/ray that's increasing in height with a known slope/radians. Height increase is also known

basically in my game I'm firing a line. The line's anchor point is at the very bottom of it, and half of its width. When I fire the line, its rotation gets set to face where we want it to go. Then, ...
0
votes
0answers
144 views

Picking tiles in an isometric diamond map

I am rendering a isometric map with the following code: for(var x = 0; x < MAP_WIDTH; x++) { this.map[x] = []; for (var y = 0; y < MAP_HEIGHT; y++) { var screenX = ...
0
votes
0answers
49 views

How do I repeat parts of some images in 2D Array in JavaScript but not all of them?

OK, I am trying to make a game that is a little bit like SimTower but utilizing HTML5 (particularly the canvas element) and JavaScript with a little CSS. I have progressed pretty far in the past week ...
0
votes
0answers
39 views

Box2d not showing consistent behaviour with sprites

Box2D newbb here. My question is in regards to this create js project:http://mboyeman.com/dashingdog/ (runs best in IE...:3) I wrote a function(assignBlockBodies) to give 2D Edges to sprites based on ...
0
votes
0answers
68 views

Javascript + HTML game slow on iOS

Just to practice, I made my own version of the 2048 game. (Link to the game is below). I don't understand why, but the UI updates with lag on chrome & safari on my iPhone 5. Since it's only ...
0
votes
0answers
75 views

EaselJS SpriteSheet isn't responding to gotoAndPlay

I'm developing a Fez-based HTML5 Canvas game using EaselJS and I've found a problem, that I can't solve myself, while trying to implement SpriteSheets to the hero. The problem is that I've defined ...
0
votes
0answers
128 views

Shifting the camera and setting a new scene when using Box2D

My jsFiddle: // START -- MOVE CAMERA var p = new b2Vec2(); p = (ball.body.GetWorldCenter().x) * physics.scale; pos.push(p); var length = pos.length; var s = (pos[length - 1] - pos[length - 2]); //in ...
0
votes
0answers
10 views

box2dweb issue in DestroyJoint function

my jsfiddle : http://jsfiddle.net/H8e9m/9/ as you can see when the ball reach the pendulum end and collide with it by a revolute joint, the problem occurred when trying to make the ball release the ...
0
votes
0answers
146 views

Animate 2D Human body Skeletal with Hands using JS

I am working on a JavaScript app to create interactive 2D animations in the browser. I'd like to create a human body. Let's consider this simple scenario to better explain what I want to achieve: I ...
0
votes
0answers
55 views

HTML5 Canvas: Get rect coords after rotation (relative to screen)

update: function(delta) { for (var i = 0; i < this.bullets.length; i++) { this.bullets[i].velocity = this.bullets[i].speed * delta; this.bullets[i].contextX += ...
0
votes
0answers
175 views

detection of a circle inside a rectangle in html5 canvas

I've created this game where the player can hit space to make the circle float in certain way. the main goal of the game is let the circle enter the rectangle .I did this code to create a collision ...
0
votes
0answers
263 views

JavaScript 3D space ship rotation

I am working with a fairly low-level JavaScript 3D API (not Three.js) which uses euler angles for rotation. In most cases, euler angles work quite well for doing things like aligning buildings, ...
0
votes
0answers
105 views

Bouncing objects against the side of the screen

I want to have certain circular objects bounce against all four sides of the screen. After searching a lot on the internet, I found the following formula: Vout = Vin - ((1+e) *dot(Vnormal, Vin) * ...