"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
23 views

Prefab disables its script when a clone is instantiated

A clone of a cube is spawned when it is destroyed, however the clones disable the script in the editor (example: http://gfycat.com/SnarlingScornfulEgg). Used the exact same script for a different kind ...
15
votes
3answers
2k views

How do I make a JS game downloadable?

I can put the HTML and JavaScript together in the same .html file, but the images need to be separate files. The only solution that comes to my mind is to give to the user a .zip folder. This is not ...
2
votes
1answer
33 views

How do I change the material of an object with Script in Unity?

I was making a game with Unity and I want to change an object's material using JavaScript when the player collects 5 collectables that I made. The collectables get stored in an int variable called ...
2
votes
1answer
39 views

How do I save variables and load them in Unity with JavaScript?

I made a game and i want to save the high score and load it back. I need to save 3 variables and load them when the game starts. How do i do it?
1
vote
1answer
33 views

How do I use elapsed time as the player's score in Unity?

I'm making a "survival" game, where the goal is to stay on a rotating board as long as possible. I want to add a score system based on how many seconds passed. For example, if you stay on the board ...
0
votes
0answers
50 views

Extracting Top-Down Race Track From Google Maps

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 ...
0
votes
2answers
46 views

How to move around in a map and remember position?

I am working on sound labyrinth game. My game is about a person getting trapped in the basement and the only way to navigate and get out is through sound. I have created a map over the basement and ...
0
votes
1answer
41 views

Move camera from wherever camera is to pinned point

So, I need to switch/ move/ animate camera from point X (not point A,as I don't know where the camera is at that momemnt) to point B (place where you want your camera to move). This is for ...
0
votes
0answers
33 views

Architecture of real time browser mmo game [closed]

I'm currently working on an MMO strategy web-based video game. Something like an Ogame with a tactical map (where you can travel, pillage other players, etc.) and in real time. That is, a game with a ...
1
vote
0answers
14 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
3answers
127 views

Why cap game loop delta-time?

I was reading some game's source code on Github and saw this game loop implementation for the first time: var lastTime = 0; var maxTime = 1/30; /** * @param {DOMHighResTimeStamp} curTime ...
0
votes
1answer
48 views

Map scrolling around the world

I am developing an TBS (turn based strategy) game. I have created a simple canvas renderer to render hexagonial map. I already implemented scrolling on the map. My current problem is that I want to ...
-1
votes
0answers
21 views

I want o develop a 4 player online card game using html5 and javascript [closed]

What else do I need to learn. I am thinking AJAX is there anything else I need. Looking for guidance.
0
votes
0answers
10 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, ...
7
votes
4answers
1k views

Is a multiplayer game in JavaScript a bad idea?

What are the possible downsides to using (client side) JavaScript when creating a multiplayer game? Game description: It's an MMORPG/RTS. That means players actively contribute to structures in the ...
0
votes
1answer
102 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 ...
0
votes
1answer
27 views

changing a sprite width when playing a reel using Crafty.js

can anyone help me with this : http://jsfiddle.net/B5UsC/20/ you can see that the sprite animation is not rendering correctly when the reel is in the last frame when animating Hardpunch is it ...
0
votes
0answers
11 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
1answer
24 views

confusion in animating a sprite sheet using craftyjs

can anyone help me with this : http://jsfiddle.net/B5UsC/15/ you can see that the sprite animation is not rendering correctly and i am guessing that i am not using the exact width of the sprite ,i ...
0
votes
1answer
57 views

I can load new tiles but how do I load new chunks?

I have successfully been able to add new tiles and place random trees on a 2d map grid however I haven't used chunks. I just load a new tile when the player moves and save it to the map array. But I ...
1
vote
1answer
52 views

Objects don't instantiate at mouse position

I'm trying to get the player to shoot a projectile at the mouse position, however the projectile is shot in weird directions (http://gfycat.com/BothFluidHoneyeater). Here is relevant part of my ...
0
votes
1answer
44 views

animating a spritesheet using crafty.js

this is my jsfiddle : http://jsfiddle.net/seekpunk/ek6ub4u5/1/ i don't understand what i am missing it's been three days now working and trying to do the animation but i am stuck ...
1
vote
1answer
67 views

how to store game state for a multiplayer board game eg. poker

First Approach: Store the state in database and play with database queries. Could a database handle the load, as poker is quite fast paced, and I have to query/update database for each player move. ...
0
votes
4answers
104 views

How to handle a negative coordinate 2d map with a growing map size

I love this procedural generation theory and have been messing around with it. However I'm having trouble wrapping my head around how to store my map data. Usually I store my map data in a 2d array ...
3
votes
1answer
55 views

CSS Sprite position updates slow due to addition of 'px'?

I'm moving fewer than 10 position: absolute elements around the screen. An enormous amount of CPU time (profiled in Chrome as (program) i.e. native code) is used where I do the following: style.left ...
0
votes
1answer
21 views

Align SpriteText position

i have this function which aligns text. static function AlignTxt(obj : GameObject, txtAnchor : SpriteText.Anchor_Pos, txtAlign : SpriteText.Alignment_Type) { ...
0
votes
0answers
14 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 = ...
3
votes
3answers
251 views

Procedurally Generated Top View 2D RPG Map Generation

Procedural generation is a fascinating concept and is gaining popularity in the gaming industry. The thought of playing a game that has new content every-time the game is played is very exciting to ...
2
votes
2answers
85 views

How do I translate accelerometer readings into object movement?

I am using the DeviceMotionEvent web API, which gives me a device's acceleration split up into x-, y- and z-dimensions and a time interval. Here's my attempt at moving an object on screen based on ...
0
votes
2answers
222 views

Why does my player stop when stepping onto a new tile?

Me and my friend are creating a game from scratch. He is in charge of art design and I am in charge of coding. I have done well so far with the code, but I have a collision detection problem when the ...
1
vote
1answer
192 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 ...
0
votes
1answer
40 views

Generate data points for shape based on an image

I am generating data points for 2d destructible scenery. Presently I had 5 for-loops (for a 5*7 2d structure) but will be expanding its resolution to outline a shape, but it will be horrible to code ...
3
votes
1answer
53 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
2answers
40 views

isometric tile tiled format javascript [on hold]

Okay im having a problem with drawing an isometric map exported from tiled. Here is my problem. where it should be like this Here is the code that i used to reproduce the 1st image, what's wrong ...
3
votes
3answers
161 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
0answers
33 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 ...
1
vote
0answers
32 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 ...
14
votes
3answers
3k views

How to avoid movement speed stacking when multiple keys are pressed?

I've started a new game which requires no mouse, thus leaving the movement up to the keyboard. I have tried to incorporate 8 directions; up, left, right, up-right and so on. However when I press more ...
0
votes
1answer
54 views

Rotating a view of a chunked 2d tilemap

I'm working on a top-down (oblique) tile-based engine. I would like for the tiles to have a definable height in the world, with Characters being occluded by them, etc. This has led to a desire to be ...
0
votes
1answer
60 views

Continous collision happening in Unity2d

I am working on Unity2d. I have a game object called gameobject1 on screen. It holds an image (named "state"). When I drag a tree on a gameobject1 collision is happening continuosly in the same layer ...
5
votes
3answers
1k views

Differences between C# and Javascript for Unity [closed]

Apart from the language differences (class-based vs prototypical, strong vs weak typing), what are the differences between using Javascript and using C# when developing games in Unity3D? Is there a ...
1
vote
3answers
108 views

Calculating step length with dividing a number that returns digits after the decimal point

How can I get rounded numbers from calculations that returns digits after the decimal point? And all the numbers together will be the number that is divided from. Explanation: I am currently working ...
2
votes
1answer
37 views

Mouse input and structure in JS [closed]

I am creating a simple concept where I have a small menu to choose a tool from and then I can click and drag to build. For example, I click on the rails tool and then I can click and move the mouse ...
6
votes
2answers
1k views

Is using multiple canvas objects a good practice?

We're developing a jump and run game with HTML5 and JavaScript and have to build an own game framework for this. Here we have some difficulties and would like to ask you for some advice: We have a ...
-2
votes
1answer
132 views

Energy Bar in Unity [closed]

I want to display a debug message when the progress bar is loaded fully and I have a button "refresh", when I click this it should reload the progress bar. Here is the code I have tried: var ...
1
vote
1answer
46 views

Removing a previously rendered image on a canvas

I made a platformer using ctx.clearRect and ctx.fillRect, so each time the player moved I would just delete the previous position and draw him again. Now I'm working on importing my own art into the ...
4
votes
3answers
2k views

ImpactJS and Construct 2 [closed]

I'm interested in HTML5 game development and I found about this 2 game engines, I already know ImpactJS requires more programming experience and that Construct 2 has its own event and action system ...
5
votes
1answer
179 views

City/Nation Builder - Unlocking game elements over time

Current Git (Needs more documentation) Current working prototype to play with (Git code is after a BIG refactor) Background: I'm making a javascript text city/nation builder along the lines of A ...
0
votes
2answers
72 views

Collision detection: Swinging bat/racket and ball

I am programming a side-view tennis game, inspired by an old arcade game, using Javscript and HTML5 canvas elements. The player can move left and right and holds a racket at arms length which can be ...
0
votes
2answers
124 views

Deal Damage to Player

I have to make a simple "avalanche" game to show I know how to use the physics and creating terrain. But I actually wanted to go a little above and beyond and actually give the player health so there ...