The Wayback Machine - https://web.archive.org/web/20161215093248/http://gamedev.stackexchange.com/questions/tagged/javascript

"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

-3
votes
0answers
27 views

Why Is There A Dark Screen When I Run The Code? [on hold]

I'm building a game where when you reach the center of the screen, it will build a new background around you. You can find the code here. I don't understand how it's happening and I've looked through ...
0
votes
0answers
34 views

how to implement a good player AI?

I'm trying to implement for players to throw rocks at zombies if possible, otherwise player will move to a rock's location in the best direction. would anyone help me find a good solution for this. In ...
1
vote
2answers
42 views

How can I increase framerate, when drawing tiles to a HTML canvas?

I am using the HTML 5 canvas to make a simple platformer game. I am currently drawing the tiles using a for loop that runs through a list of tiles and checks if they will be drawn to the screen. for (...
1
vote
1answer
25 views

How to Prevent Entities Snapping Through Platforms

I am using crafty.js to make a platformer. I assigned the main player entity the default jumping controls and movement with .twoway() and used .checkHits() against the obstacles ("obs") the player ...
0
votes
1answer
33 views

Javascript game engine that can work 'seamlessly' with react-native

I have previous experience with Unity, but I don't like the fact that Unity compiles your game directly into APK (or IOS equivalent). It's because I want to modify the game to provide chat interface ...
0
votes
0answers
26 views

HTML5 game graphics frameworks, engines, libraries [closed]

I started developing a HTML5 Game and wondered which engine, libraries or framework I should use in order to be able to have graphics, player interactions and collisions like those games have: ...
0
votes
0answers
39 views

How to make it so that character hurts enemy with its body (Javascript)?

I'm fairly new to this. Been in the middle of making my first game for a few weeks now and I'm a bit stuck when it comes to making it so that my character destroys enemies when touched. I read ...
0
votes
0answers
39 views

How To Create Movement Between Maps In JavaScript

I'm trying to make a basic game in which if you reach the edge of your screen, it'll bring you back to the start of your screen but with a different background. Something like: ctx.canvas.width = ...
1
vote
1answer
22 views

RPG Maker MV stop refreshing items in shop

Well, the thing is that i've been using Attachable Augments (a GREAT plugin made by Yanfly, check yanfly.moe for more info) for a while, but I feel that something was not there. You can buy items and ...
0
votes
0answers
13 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
40 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
60 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
26 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
22 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
27 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
12 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
318 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
46 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
49 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
24 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
70 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
30 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
47 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
17 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
31 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
323 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
76 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
84 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
46 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
54 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
53 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
49 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
68 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
124 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
59 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
47 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
39 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
72 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
26 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
24 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
95 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
53 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
149 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
54 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
77 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
122 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 ...

close