"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

3
votes
1answer
670 views

How can I place my Enchant.js game into a DIV in a fully-designed web site?

Following the Enchant.js tutorial I cannot find a way to define the place the game is rendered in the page. It either takes the maximum possible area or limits itself to the given size (using ...
2
votes
2answers
92 views

How do I detect when an HTML 5 game has ended?

I'd like to embed HTML5 games in a website, but I need to be able to detect when the game has ended so I can run some of my own JavaScript. Looking at the output of some game engines (Construct 2, ...
0
votes
1answer
76 views

GameObject remains null for some reason

The idea is to access the function BlockWasDestroyed(); from Combo class. Instead of var combo = gameObject.GetComponent(Combo); I've also tried with var combo = GetComponent(Combo); var ...
2
votes
2answers
1k views

android game development using unity 3d [closed]

I want to learn android game development. I dont have any programing knowledge. So should I learn JAVA and eclispe to develop games for android. Or should I learn Unity 3d. And is knowledge of java ...
0
votes
1answer
636 views

Error when using GetComponent (Object reference not set to an instance of an object)

I'm using a textmesh to check variables in real time. Thing is if I use AddComponent within Update(), it obviously starts spamming and slows the game. If I try with GetComponent the error is the ...
1
vote
1answer
42 views

Wrapping each script with classes causes errors

The goal here is to change variables from another script. Thing is that they must be in classes, so for example I wrapped this code (which is from PadControl.js): #pragma strict public var ball : ...
0
votes
1answer
94 views

Box2D: Adjusting character position for side-scrolling

In my side-scroller I would like to give the illusion of the character walking forward while his sprite is actually being held in place. If he walks near the edge of the screen, I would like to adjust ...
1
vote
1answer
171 views

Custom lookAt function goes wild

I have written a custom lookAt function based on a lot of posts from all over the net, and it works very nice... except when a rotation (which is stored in a quaternion) crosses some 'threshold'. ...
2
votes
2answers
154 views

How do I implement friction in a billiards game?

I'm having trouble implementing friction in a billiards game. Currently, the ball only slows on collision with the edges, but I also want some friction with the background. How can I implement ...
1
vote
1answer
244 views

Can't edit specific variables from the inspector panel, while variable is static

In order to make the variable accessible from other classes, I have to make it static. When I make it static, I can't edit it from the Unity's Inspector panel. No way to be able to do both: ...
-1
votes
1answer
56 views

Why does loading a JSON file require the usage of a callback function? [closed]

I was wondering why functions that parses JSON files always use callback functions instead of just returning loaded response text? An example here and here. If it is possible, how would I return this ...
0
votes
3answers
117 views

How would I apply my isometric art onto isometric CSS with correct Z-indexing

I have been trying to wrap my head around how to apply my isometric art into an array like so with correct z-indexing In the long run I want to be able to select a specific tile and depending on ...
2
votes
0answers
34 views

Presentation / input layer that communicates with server [closed]

I want to learn more abot how to use some kind of presentation/input layer that communicates with server for HTML5 games. Instead of sending all the code to the clients browser, I would like to just ...
1
vote
1answer
254 views

How can I restrict the rotation of an object to a subset of axes using quaternions?

I've got a question about quaternions in my WebGL application. How can I rotate an object only around two axes? For example, how can I exclude/nullify rotation about the Y axis? The problem is that ...
0
votes
0answers
9 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 ...
3
votes
1answer
128 views

Game loop in Javascript

I've been into javascript game programming with html5 and canvas lately. So far I've only been able to implement a game loop with setInterval, but I'm aware this means using fixed timestep. I've ...
0
votes
1answer
194 views

Developing a general use multiplayer API [closed]

I'm tasked with the development of a general use multiplayer API in JavaScript, with a Node.js back-end. The goal of the API is to provide a service to JavaScript mobile game developers so they can ...
2
votes
1answer
908 views

How do I query a server with visible map tiles? [closed]

In my game, I need to retrieve data of items in the visible tiles based on what tiles are visible in the viewport. I am planning to make a batch AJAX request with the visible tiles, containing image ...
0
votes
0answers
141 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
1answer
126 views

Strange quaternion camera streching in WebGL

So after a lot of researching about quaternions I almost got the quaternion camera working. Almost, cause it rotates in a proper way only in a vertical axis. Other rotations stretches and deforms the ...
1
vote
1answer
52 views

SVG—Adding fire to the roket

as you might expect, I have got a game in development, including a main character—fortunately… This character is on the one hand represented by a bunch of Box2D bodies and on the other hand, ...
0
votes
1answer
44 views

What is the actual formula to find the vertices of an animation frame in using a BVH file?

I've read this tutorial and tried many formulas to build the skeleton. I am able to build it without the rotations, but those break everything. This, for example, is a simplified code for one of my ...
1
vote
1answer
320 views

Should game logic update per second or per frame?

I'm trying to wrap my head around how and when to update an entities position. My game loop updates logic at 25 FPS and renders at 50-60 (Depending on the computer hardware). So lets say I'm moving ...
0
votes
1answer
79 views

setting a time delay between two frame when animation a sprite sheet

this is my jsfiddle :http://jsfiddle.net/Z7a5h/ As you can see the animation of the sprite sheet when the player is not moving is too fast so i was trying to make it slow by declaring two variable ...
5
votes
3answers
7k views

Where is the Aves game engine?

The Aves game engine made a splash last spring/summer, with very impressive demo videos. I went back to check on them, and it looks like their site has long since died. Google also doesn't seem to ...
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 ...
0
votes
1answer
208 views

(WebGL) Point light per-fragment issue

I'm using an FPS-like camera, this is the code: CAMERA mat4.identity(mat.mvMatrix); mat4.rotate(mat.mvMatrix,degToRad(-camera.pitch),[1,0,0]); ...
1
vote
1answer
153 views

JavaScript: Rotating a canvas around its center for a 2D sidescroller

I've been making a 2D sidescrolling game using JavaScript and HTML. The game is set in space, where the player character can fly around (Up, Down, Left and Right keys) and rotate the world around him ...
0
votes
1answer
130 views

2D animation is not rendered as it supposed to

I'm working with Melonjs, i have configured everything to update the character movement and still get this "delayed" rendering of the character. below is the constructor // call the constructor ...
1
vote
1answer
133 views

UV Texture coordinates out of [0,1] (WebGL)

I'm creating a 3D game with WebGL and i'm using Wavefront Objects as a base model format. I recently found some models, their texture coordinates of which are out of the typical [0,1] range and 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 += ...
3
votes
2answers
215 views

Loading chunks of the terrain relative to the player's position

I'm making a small voxel-based multiplayer WebGL game with a Node.JS server which handles player positions and sends terrain chunk data to the clients. This is an example of how I'm currently sending ...
3
votes
1answer
2k views

HTML5 - Dynamic canvas grid for scrolling a big map

I've been working on different scrolling algorithms for my JS-based game. My main problem is that I need to draw a huge map and also have it scroll smoothly. I've made a few attempts and while they're ...
1
vote
1answer
89 views

Passing a list of existing entities to a new client when using a component system?

My game server uses entities containing components to represent everything in the game world. This has worked great so far but I've run into a problem now that I'm allowing clients to connect to the ...
2
votes
1answer
93 views

Deterministic calculation in JavaScript [closed]

I want to create a multiplayer game with HTML/JavaScript and only send user input between players. I read some articles for C++, saying that I could not expect floating point to get the same results ...
0
votes
1answer
109 views

How do I add a canvas tag to my ocean id in javascript? [closed]

I'm trying to create a "wack-a-mole" type of game. I've gotten all of the lines of code except in one area. Here is all of the code: <!doctype html> <title>Squid Smash!</title> ...
10
votes
0answers
910 views

How to create 2D shadows [duplicate]

I'd like to create lights and shadows in a 2D environment, like in the image below: I did several searches but got no results. Do you have any hint?
0
votes
1answer
180 views

How to play a video on a TV model inside a game?

I am new to Unity3D. I need to know how can I play news when I switch on a TV using any scripting language in Unity3D ?
1
vote
2answers
290 views

Mega Man screen scrolling in JavaScript [duplicate]

I'm trying to create screen transitions similar to those found in Mega Man or Legend of Zelda (i.e. the active elements of the first screen are stopped as the screen scrolls in the direction of the ...
0
votes
1answer
386 views

Planet gravity? [duplicate]

I am trying to make a game with the Phaser game engine and would like to implement some sort of planetary gravity. Essentially I just want the player to be able to walk on a circle or orbit a point. I ...
2
votes
3answers
123 views

Box2dWeb: setting velocity of bodies using events

I would like to move a kinematic box by pressing the down arrow. As is noted by the console logs, the keydown actually does change the box's velocity... but for reasons beyond my grasp it still ...
-1
votes
2answers
284 views

How do I make a 2D platformer AI aware of its allies?

I'm trying to develop a 2D platformer AI that is aware of its buddies and tries to not overlap with them. However, I always end up with an "snake": I dont want them to be so robotic, but instead ...
1
vote
2answers
255 views

How can I center a circle around a point on an HTML canvas?

I've got a job to make an engine and light game for canvas in HTML5. I like the things I make to be centered on the x,y positions I give it, I don't know why, it just helps me think about them ...
3
votes
2answers
580 views

HTML5 game fps render lag

I am currently creating a flappyBird-like HTML5 game using Proccessing.js You can see current work here: http://files.tips4design.com/flappySlothRelease/ The problem is that even though the FPS is ...
0
votes
1answer
71 views

board game card spacial events handling [closed]

im implementing a not so simple board game, i have a way to do most stuff (start game handling,turn handling,combat system,movment etc). im having a problem with spacial cards that players draw,the ...
-2
votes
1answer
187 views

How should I start with Android development? I am basically a PHP HTML JAVASCRIPT developer [closed]

I am a PHP developer wanting to learn Android game programming. I tried java with ADT and android SDK, but I found Java confusing because of its complex Object-Oriented structure. I've heard we can ...
0
votes
2answers
283 views

Tweening multiple image objects in html5/js

Is there an optimal way to choose when tweening multiple images as a single image? For example let's say i have 10 preloaded image objects in my script, and i want to place them one on top of the ...
0
votes
2answers
82 views

JavaScript character direction delay [closed]

I am developing a top down game and I'm having trouble with a delay in switching from one character walk direction to another, particularly if the previous direction key is still being pressed by the ...
1
vote
2answers
113 views

Calculate tile ID on a Reus style world with canvas context.arc()

I need a bit of math help for my game. I'm using Javascript and the Canvas tag to create a circular world, think God Finger, and Reus. The current version of my game is here: ...
2
votes
1answer
232 views

How to make bullets follow a rotating sinewave pattern

I am trying to replicate the wave gun from Super Metroid where the bullets fly along a sine wave path. The cool part is that you can shoot in 8 directions and the bullet still follows the sine as if ...