"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. http://en.wikipedia.org/wiki/...

learn more… | top users | synonyms

0
votes
0answers
9 views

How to load multiple functions with EventListener without them sharing the same variable

While creating a Tic-tac-toe game, I ran into a wall. I can't run my AI and the getClicked function at the same time without having one with the other. If I do, then the "link" will already be ...
0
votes
1answer
31 views

why are my client and server physics not syncing up? node.js and html5

My server looks like this - var timestep = 1000/30; var delta = 0; var lastFrameTimeMs = 0; function panic() { delta = 0; } var update = function(){ ...
0
votes
1answer
50 views

SailsJS + Rotational direction coordinates calculation issue

I'm creating a small game to learn how NodeJS & Sails work (and by extension Waterline, Socket.io, Express, and all their components). I'm using websockets to make the server calculate the ...
1
vote
0answers
23 views

WebGL frame rate slows down after triggering javascript event

I am using Unity WebGL to host my game on a flask server and trying to throw a warning to the user whenever he tries to navigate away from the tab or mistakenly click browser's back button. Each time ...
0
votes
0answers
19 views

Phaser P2 - How to create contactmaterial?

I'm trying to make a game with Phaser. I want my player to slide down a hill I made with a polyline in Tiled. The player is sliding down it, but verrrry slowly. So I'm trying to make contactmaterial ...
-1
votes
1answer
24 views

Resolve Unity error about “Constructors and field initializers” on the loading thread

The code below is producing an error message I don't understand: Constructors and field initializers will be executed from the loading thread when loading a scene. Don't use this function in the ...
0
votes
0answers
11 views

Sorting sprites above the surface of 3D mesh?

I'm having trouble getting sprites to display on top of a 3D mesh. My requirements are as follows: Sprite should billboard Sprite should not clip into the mesh Sprite should be hidden when on the ...
7
votes
1answer
310 views

Unity JS to C# conversion - Incomplete list of public variables in Inspector

I'm trying to convert a javascript file to a C# script for Unity, mostly because the rest of my workflow is in C#, and I'm much more comfortable with C#. In this case, it's an audio controller script....
-1
votes
2answers
40 views

JavaScript Collision Detection bug

Hello to all who are reading this post In trying to make Mario type of game but I have some collision bug maybe someone can explain to me whats is incorrect and how to fix it Collision part there ...
0
votes
1answer
45 views

Structure game database to store player info and items

Recently I started developing my tiny html5 multiplayer game made in Node.js, Express.js, MongoDB(Mongoose), Socket.io and using Phaser.js. I am quite new to these frameworks and especially new to ...
0
votes
1answer
23 views

Rotated canvas sprite not drawing properly

First, sorry for my english. Said that: Recently I began to study JavaScript and like a way to consolidate what I learned I decided to make a simple video game with canvas and javascript: kind of ...
0
votes
1answer
45 views

How to connect circle nodes using arrows?

I'm trying to design a simple game where a series of numbered circles can be connected by arrows (like mobile phone pattern locks). I have these circles designed here: https://jsfiddle.net/sarmadm/...
0
votes
1answer
28 views

Camera movement, Draw grid

If I have a 20x10 grid (640x320) where tiles are 32x32 The grid are rendered: for (var y = 0; y < 10; y++) { for (var x = 0; x < 20; x++) { var tileX = Math.round(Camera.x / 32); ...
0
votes
1answer
45 views

Perlin noise terrain issue when scrolling

I am generating a terrain in Javascript canvas using this js project for the Perlin noise. I have an array of points, and when one point leaves the left-hand-side of the window, it is removed, and a ...
0
votes
2answers
19 views

Timebased transition from start to end value

I'm trying to implement time line objects, the purpose of those would be to issue events at specific times. When and what is specified through objects called units, which is what you attach in the ...
0
votes
1answer
15 views

How to check mouse coordinates and mouse events

I'm building a simple game where if the mouse's X coordinate is greater than 200, and you click, the screen will turn red. Here's the code: var mouseX = event.clientX; var mouseY = event.clientY; ...
0
votes
1answer
29 views

Reset Camera view - webgl

I have camera rotating by dragging mouse. Im trying to add reset button that restart the scene to initial view. The rotating camera works as expected but I can't figure out how to reset it. The ...
0
votes
2answers
315 views

Unity Random.Range not repeat same position

I have this code that generates blocks in random position and it works but some times it generates blocks at the same position ,how can I fix it? var dupeobject : GameObject; function Start(){ ...
0
votes
3answers
75 views

Calculate damage values from bullet velocity and size

I'm trying to make a top-down game using javascript and Pixi which involves multiple different guns. Instead of giving each gun an individual damage value, I wanted to calculate the damage by the ...
0
votes
1answer
82 views

Is javascript viable for serious multiplatform 2D game development? [closed]

Ever since I was a little kid, my dream has been to develop games. Well, now that I am older, more mature, and have some programming experience, I would like to start. However, I would like to turn ...
0
votes
1answer
45 views

Default color for 3D scene

I have webgl 3D scene with background image and few shapes with textures. I want to add some lines and other shapes and apply on them default color which not affect the shapes with textures. How can I ...
0
votes
2answers
53 views

Any idea to be able to make the character still continue the game until no heart left

I am newbie I am making a 2d game in unity 3d my code for the character game over is this.. I can get the heart less one heart if game over but turn back to five again I just want to decrease heart ...
-1
votes
2answers
52 views

Any idea unity game 2d coins reset when starting new game

I am newbie any help would be really much appreciated thanks in advance :) Example I am game over I earned 30 coins and start new game and coin in the game start with 0 and the coins collected in ...
0
votes
0answers
36 views

Circular soft body? Matter.js or other js engine?

I am using Matter.js physics in an attempt to create soft bodies. I was able to create a body like this: However I am not sure if this is the "soft body" I want. It is true that this body is not ...
2
votes
0answers
67 views

I'm having very negative thoughts, can you help me? [closed]

I'm 27 years old and I recently started vocational studies for app development. The first year is mostly about introduction to c# programming and also a light introduction to html and javascript. I ...
0
votes
0answers
102 views

Drawing a 2D circle in a 3D World

I am trying to draw a 2D circle in 3D world. I have some spheres in my WebGL scene and am trying to add this code to draw the circle but it is not working. There is no error exception, however. ...
0
votes
2answers
54 views

How to draw an image on canvas without html

I'm trying to add a sprite to the canvas of my game. However, I don't want to use an image tag. However, I haven't found a way to do this no matter how hard I searched. Something like: var image = '...
0
votes
2answers
45 views

How add a sprite to canvas using JavaScript?

I'm very new to sprites and I'm trying to figure out how to use them. I want to use a simple solution. Something like this: var c = document.getElementById ('canvas) var ctx = c.getContext ('2d'); ...
0
votes
1answer
38 views

Character movement resetting x & y position in HTML5 game

I have an HTML5 game I'm working on and I'm at the point where I'm trying to make the character move. For the most part, the character(A rectangular square) is moving, but it's not moving from its ...
1
vote
0answers
63 views

Creating an Isometric tile map with HTML5

I'm trying to create an isometric tile map using HTML5 Canvas. Everything I've found online points me towards using a pre-built engine. I'd like to learn how to do this without using an engine. Is ...
0
votes
0answers
23 views

Prevent zooming and stretching in Phaser

I'm new to Phaser and currently creating top-down game where a camera should follow the player. The problem is I don't want any zooming, stretching or anti-aliasing (Phaser is terrible at that). Just ...
0
votes
1answer
21 views

Code reading difficulties with raycasting engine

I'm trying to teach myself to program some basic engines. I've been following this tutorial: http://www.playfuljs.com/a-first-person-engine-in-265-lines/ to get a decent idea of a basic way to render ...
0
votes
1answer
90 views

orbit object around another object

I am building 3D solar system containing (sun > earth > moon). I have difficult to add the part which the moon rotate around earth. I separated between "moon" and other stars. The problem is that the ...
1
vote
0answers
49 views

rotate 3D sphere around itself - webGL

I'm trying to build 3D solar system with webGL. I have all the stars moving in a circle around the sun as sholud be, and I want them also to spin around their own Y axis. How can I add it? I tried : ...
0
votes
1answer
23 views

Line rect intersection - lines behave like rays

Why is this? I have a simple ship that is a 14x14 rectangle, and a contour map. I want to be able to determine when the ship hits the ground. Here's a link to the JSFiddle. Here's what happens now: ...
0
votes
1answer
28 views

Line rect intersection

I've been reading Timothy Wright's "Fundamental 2D Game Programming With Java". I'm trying to apply its principles to a Lunar Lander game - it's a JSFiddle for now, and can be found here. The problem ...
2
votes
2answers
120 views

Three.js— how to rotate sphere without moving light (using OrbitControls)?

Okay, I think the problem that I'm having is that when I create my DirectionalLight with three.js, when I then rotate my object with OrbitControls the entire scene is rotating, not just the sphere I ...
0
votes
1answer
47 views

Why can't i change the background color in Phaser?

what is wrong with my code? i'm using game.stage.backgroundColor but the screen remains black. main.js: var demo = demo || {}; demo.game = new Phaser.Game(window.innerWidth, window.innerHeight, ...
0
votes
1answer
69 views

JavaScript - Updating a canvas real-time… from server-side or client-side

I have this 2D tilemap game 13x13 viewport (169 tiles drawn on canvas at a time) of a 150x150 map. Each tile is 32x32px. Obviously I only update the 13x13 viewport... I want to update a canvas in ...
0
votes
1answer
120 views

How can I make my movement continuous?

I'm making a game with simple movement code. I don't want the movement to be too complex since it's going to be a small game once it's done. Right now the character moves 10 units at a time, then ...
1
vote
1answer
22 views

Breaking up a 2d shape into small triangles

I have a "piece of cloth" (2d shape) that I'm applying soft-body physics to. This works great when the shape is a square and I can create a regular grid of vertices between which are hung the cloth's ...
0
votes
1answer
52 views

How do I make an HTML5 canvas tiled map with tiles which have other than squared edges?

I'm creating an HTML canvas map and I'm trying to have the edges of the tiles not appear square, as in the tiles merge in to each other. I've scoured the internet for hours but can't seem to find ...
0
votes
0answers
19 views

Cocos2D - Detect how many items an object collided with / negating more than one object

In creating a small breakout clone, I've managed to get the ball to bounce whenever it hits a block by negating (or multiplying by -1) either the X or the Y values. This works, at least until the ...
0
votes
0answers
13 views

Cocos2D-JS how to get which edge has collided with an object?

I'm creating a Breakout clone using Cocos2D-JS, and apparently one of the easiest way of getting the bouncing right without physics is to simply negate either the X or the Y value of the moving ball, ...
1
vote
2answers
41 views

Board Game Pathfinding - Finding optimum valid path with limited path distance?

I'm building the very earliest stages of piece movement in a digital board game I'm planning to make. It's a browser based javascript system. Basically the players roll to move and need to traverse ...
0
votes
1answer
20 views

Cocos2d JS - Getting vector reflection

I'm working on a small Breakout clone using Cocos2D-JS, without the use of a physics engine. One of the things that baffles me was how the ball bounces. My friend came up with this: inputVector - ...
0
votes
0answers
14 views

Cocos2d-JS using Box2D - no contact / collision or bouncing

I'm trying to make a simple Breakout game with Cocos2D-JS, following this tutorial. Since the tutorial is for iOS, I'm doing my best to translate the code into JS. As I noted here, some of the ...
0
votes
0answers
22 views

Cocos2d-JS using Box2D b2EdgeShape / SetAsEdge crashes

I'm trying to make a simple Breakout game with Cocos2D-JS, following this tutorial here. Unfortunately, said tutorial is for iOS, while I'm doing this in Cocos2d-JS. Right off the bat I had issues, ...
0
votes
1answer
47 views

2d animation on html5 canvas using a vector and speed

Im moving a starship from one location to the other. In creating a vector, normalize and magnitude it. Lets assume my vector looks like this Vector x: 156, y: -90, m: 180.0000000546, ...
1
vote
1answer
36 views

Sprites in Object Pool spawning and updating, but not rendering

So I've been trying to draw sprites onto the world canvas. These sprites are held in a Group (aka object pool. They are meant to be bullets). They update properly, even go off bounds, but they never ...