Tagged Questions

"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

0
votes
1answer
130 views

How to solve problems with movement in simple tile based multiplayer game?

I'm making a simple tile based 2D multiplayer game in JavaScript using socket.io where you can move one tile every 200 ms. The two solutions I've tried are as follows: The client sends "walk one ...
0
votes
2answers
201 views

How to move an object using X and Y coordinates in JavaScript

I am making a 2d baseball game with JavaScript and HTML5 and am trying to move an image that I have drawn with JavaScript like so: //canvas var c = document.getElementById("gameCanvas"); ...
1
vote
1answer
238 views

Omni-directional light shadow mapping with cubemaps in WebGL

First of all I must say, that I have read a lot of posts describing an usage of cubemaps, but I'm still confused about how to use them. My goal is to achieve a simple omni-directional (point) light ...
4
votes
2answers
2k views

How to ignore collision between two objects

I have a player that shoots in the direction that it is facing. However, the shot that is created when I click, also destroys the player (example). How would I make the shot ignore collision with the ...
1
vote
2answers
203 views

Can I have keyboard controls in an MMO and still do movement calcuation in the server?

I'm trying to decide between keyboard and mouse movement controls for a web-based multiplayer. It would be quite resource-intensive to use the WASD-keys and AJAX the server with controls every second. ...
-1
votes
1answer
149 views

simple collision detection with box2dweb

im beginner in box2dweb that version of box2d for javascript i wrote simple gravity system and i want to detect the collision between the box and the ground , when the falling box hit the ground ...
3
votes
3answers
280 views

How to launch a prefab at the mouse position

I want to use Instantiate(item, new Vector3(...), Quaternion.identity) to land an item at the position that was clicked. My game is using a third-person view (example). This is the code that I think ...
0
votes
1answer
91 views

How to store and use different AI behaviours

I'm coding a space shooter on three.js (WebGL) and since the game I'm doing is rather simple, plus I want to keep controll of the structure, I'm not using a game engine. I'm using oop classes and ...
-1
votes
4answers
239 views

How to increase the game “level” after certain amount of objects spawned?

The game is supposed to increase the level by 1 every 10 spawns of an object, using totalShots % 10 == 0. So, when totalShots is equal to 10, 20, 30, etc. the level should increase by 1, however, the ...
0
votes
1answer
804 views

How to randomly spawn object using instantiate

I'm trying to spawn objects which move in one direction until they hit a player or the barrier. The spawner is a cube which moves between two points to spawn the object at different locations. The ...
1
vote
2answers
229 views

Object goes straight through game object without colliding

The "shot" is supposed to collide with the left bumper and then be destroyed, but the shot goes right through it. Both objects have a box collider. The following is the code I am using: #pragma ...
0
votes
1answer
110 views

WebGL wrong scaling of rectangle

I'm working with this tutorial http://www.html5rocks.com/en/tutorials/webgl/webgl_transforms/ and my result is, that the rectangle moves in the direction of it's scaling values, and also scales at ...
3
votes
1answer
295 views

storing user data for rpg

I'm creating a single player Web rpg that will store a decent amount of information about the player, items, map, npcs, etc. I have been developing html5, javascript, php, and the mysql database ...
1
vote
2answers
143 views

RPG: store dialog

I'm creating a single player web RPG. I was originally storing NPC dialog in a JS object. I could cycle through lengthy dialog in an array as I wanted. I can also store objects with K:V pairs. That ...
0
votes
1answer
93 views

Check legal movement on grid map

i'm trying to develop a simple multiplayer turn base game, i'm start creating the grid map, i have already write the javascript script to display the range movement for the specific unit, but my ...
0
votes
0answers
38 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
66 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 ...
-2
votes
1answer
70 views

How do I make other players see one player's die rolls? [closed]

I'm new to PHP and making a simple dice game. It works well in single-player, but in multi-player, I don't know how to show the results of one player's rand(1,6) dice roll to the others using a web ...
1
vote
2answers
77 views

How do you account for zoom in a top down viewport?

I've been stumped on this for days so please forgive me if this question is in bad-form. I have a generic top-down RPG structure, and I want to create a zoomable Canvas viewport for it. I've read ...
-2
votes
1answer
108 views

in a 2D game that has an array as a map how to make graphics look nice?

I have a map that's stored in a 2D Array with 1s being walls, 0s being roads, and 2s being houses. There is a character that is not stored in the map but its position is always checked against the map ...
3
votes
1answer
140 views

determine collision angle on a rotating body

update: new diagram and updated description I have a contact listener set up to try and determine the side that a collision happened at relative to the a bodies rotation. One way to solve this is ...
1
vote
0answers
34 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: ...
0
votes
0answers
71 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 ...
2
votes
0answers
65 views

Certain sound is played after last if within script [closed]

The idea is to make the sound work when comboTime is false. However, it works in an unexpected way: the sound works after the last if statement within ComboHud.js, which is: if (Time.time > ...
0
votes
2answers
221 views

what function creates rotation effect in three.js?

which part of the code is responsible for the rotation in this example? Is it the camera or the scene itself? http://threejs.org/examples/#canvas_camera_orthographic
2
votes
1answer
679 views

How do you set the target location for a navmesh using a GameObject?

I am trying to get a GameObject to navigate through a map and get to the exit. I have created a navmesh for the map and given the player GameObject a navmesh agent. The exit is marked with a empty ...
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
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
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 ...
1
vote
1answer
849 views

Adapting tilemap algorithm to support isometric tilemap

I'm using Phaser to build an isometric game. The framework doesn't have support for isometric tilemaps yet, so I'm starting to write a PR for it to support. What I currently have, loading an ...
0
votes
1answer
611 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 : ...
2
votes
2answers
152 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
231 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 ...
1
vote
1answer
169 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'. ...
0
votes
3answers
115 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 ...
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
127 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
190 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 ...
1
vote
1answer
250 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
140 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 ...
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
125 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 ...
-2
votes
2answers
123 views

collision detection algorithm issue

here is the jsfiddle i am working on so far : http://jsfiddle.net/TLYZS/ if you debug the code and check the collision function you can see that the collision is working fine when the user overlap ...
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
313 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 ...
1
vote
2answers
801 views

Dealing with multiple animation state in one sprite sheet image using html5 canvas

I am recently creating a Game using html5 canvas .The player have multiple state it can walk jump kick and push and multiple other states my question is simple but after some deep research i couldn't ...