"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
0answers
13 views

Game loop with fixed timestep gives strange result

So I've read the famous article at http://www.koonsolo.com/news/dewitters-gameloop/comment-page-2/#comments which describes different methods of implementing a game loop. I've tried to implement the ...
0
votes
0answers
5 views

How to include a new file js in a project cocos2d js?

I'm trying to include a new js file containing a new scene on a cocos2d js project, but every time try occurs the following error: Uncaught ReferenceError: GameScene is not defined. I included ...
0
votes
0answers
18 views

Sync bullets node.js phaser.io

i am currently having a struggle thinking about syncing bullets. I am using node js and phaser.io and I am creating top-down shooter. I would do it like this: Player shoots a bullet. Player ...
0
votes
1answer
32 views

How to move 2D objects based on mouse movement with pointer locking?

I'm using pointer locking for a 2D game (where you perform calculations based on the delta in mouse positions from frame to frame). I'm having some basic math/logic issues with accomplishing what I ...
0
votes
0answers
18 views

Event handling for moving components in an HTML/JS game

I have developed a working prototype of an arkenoid-kind of game using plain HTML/JS/CSS3. I am using the DOM to display game elements. The whole game is infact contained inside a table element. Table ...
0
votes
1answer
29 views

Make a person walk faster when standing on plane/panel in Unity?

Is it possible to make a person walk faster when standing on plane/panel in Unity without writing a lot of code? If so how? I am using the standard asset first person movement prefab.
0
votes
1answer
50 views

Targeting logic for 100.000 units army

I am making an army fight for my website armyfight. There can be fights of hundreds of thousands units. I am looking for better unit targeting. in jsfiddle is an example. var enemy = { 2: { ...
1
vote
1answer
45 views

Simulating elastic ball collisions quickly escalates to disaster

I'm trying to learn HTML canvas and was working on a basic physical simulation, where a number of balls are drawn and set in motion, and the program simulates them colliding and bouncing off the walls ...
0
votes
1answer
38 views

Bouncing from any object after collision JavaScript

I'm trying to make a ball bounce off some obstacles after a bounding box + pixel by pixel collision. Somehow, sometimes the ball is not going in the direction it is supposed to be. If the ball is ...
0
votes
0answers
43 views

Errors in code examples from the book “Advanced Game Design with HTML5 and JavaScript”

I have purchased Advanced Game Design with HTML5 and JavaScript and have started going through the chapters. I notice that after chapter 2 I get code errors and the source code from the downloads ...
1
vote
0answers
65 views

Pixel by pixel collision detection pinball

I'm currently working on a Pinball game using the HTML5 Canvas and JavaScript. Right now I'm getting a hard time with the pixel by pixel collision, which is fundamental because of the flippers. Right ...
3
votes
1answer
54 views

SDD Inverse Kinematics with constraints

I have a question regarding my quest on onderstanding IK solvers. After viewing this movie on YouTube: https://www.youtube.com/watch?v=MvuO9ZHGr6k I started recreating it with JavaScript. Just 2d on ...
0
votes
0answers
15 views

Emscripten / webgl lazy rendering?

I compiled existing opengl es 2.0 code to webgl using emscripten. In the desktop version there is lazy rendering mechanism that only renders when required which is basically just saying invalidate ...
0
votes
1answer
20 views

How add a PIXI container into a Phaser Game?

How add a PIXI container into a Phaser Game? I have a game made ONLY with PIXI. but now i would like to port it to a Phaser. All my game content happens inside a pixi container "screenContainer". ...
0
votes
1answer
83 views

Why do my trees share the same health?

My trees keep on falling at the same time and I am not sure why! I am new to Unity3D javascript. Here is my script: #pragma strict //INTS var health = 5; //GAMEOBJECTS var tree : ...
0
votes
1answer
26 views

design / data structures

I'm working on a game which I'm writing in Javascript and then porting to iOS/Android via phonegap/cordova. For the most part, I understand how to code and how to get what I want to happen, BUT I ...
0
votes
0answers
13 views

add physics to a group or container body in phaser

I'm developing a HTML5 Phaser game. In this game I do have a Group which I would like to behavior as a physics body (arcade-physics). It is a character with a lot of moving parts (sprites) inside ...
0
votes
0answers
28 views

NodeJS timed update approach

My game has users building buildings, recruiting units, trading resources and sending attacks. All of this functionality takes a certain amount of time to happen and I'd like help with deciding on the ...
0
votes
0answers
18 views

Collision event callback on p2js not working

So, I'm making a simple game on Phaser where a ball object and bullet group collide with each other, incrementing a score variable whenever this happens. I already set up the collision groups and are ...
0
votes
0answers
28 views

Create a character from multiple sprites

I have multiple spritesheets for a character in my game. The user can decide which gender, which hair, which haircolor he wants. Some images have to be on a higher layer than others (hair > head > ...
1
vote
2answers
57 views

Maths ? coordinates rotating around coordinates

could you geave me a tip please, a redirection to what is the "simple" math I need to learn and understand for the rotation of an object (its coordinate x, y) around an other object (an other x, y), I ...
0
votes
1answer
19 views

Webgl, weird rendering with sprite that has alpha

So I have a webgl application where I render all kinds of objects, but in this specific example, I have two shaders. One that renders sprites and one that renders colored polygons. In this example I ...
1
vote
2answers
84 views

Canvas slowly degrades in performance after a while

I was creating a simple game and was shocked to see how the performance started to degrade. It never happened to me before, most probably because I use images and not the context drawings. So I used ...
1
vote
0answers
32 views

How to fix my physics functions so they perform at the same speed across different FPS's

My jump function looks like - self.jump = function(){ //do the initial jump if (self.pressingUp && self.onGround) { //this just gets it off the ...
0
votes
1answer
62 views

Fastest way to render isometric world with moving entities?

I've got an isometric diamond-shaped world. The world consists of isometric planes like rooms. The walls and floors of the rooms and all obstacles and items in the rooms are isometric entities. So I ...
0
votes
0answers
18 views

Camera movement on a sphere, and how to look while doing it

I am trying to make some kind of pointerlocked walking simulator that involves movement of the camera on the inside of a sphere. I've looked at Walking on a sphere, but that solution fights what I'm ...
0
votes
0answers
29 views

Multiplayer Keeping the Client and Server Updates in Sync?

I am working on a Multiplayer Game, I have a client loop which can run at 30-60fps. Inside of that Loop I check whether the players left mouse is down. If it is, send a shoot command to the server. On ...
0
votes
0answers
9 views

Clicking an entity with transformation

I am trying to understand how best to implement a click detection function in a 2d JavaScript game. I can demonstrate using a simple example of two square 'entities' which can be selected when ...
2
votes
1answer
72 views

How to implement map scrolling inertia formulae

I'm looking for a mathematical formulae to calculate map scrolling inertia. Basically I have an HTML5 Canvas displaying part of a map and I capture the mousedown / mousemove / mouseup to calculate my ...
0
votes
0answers
22 views

Why are my components empty in my Entity-Component Model Javascript/Phaser implementation?

I'm developing a game in JavaScript using the Phaser framework, I'm trying to implement the entity component model so that all my objects can be Entities, so far I've got an Array of entities that ...
1
vote
0answers
40 views

Phaser - Add collision to a specific tilemap layer?

In Tiled I made two layers, "Background" and "Walls" and I have positioned them accordingly, both as a background and walls, or if you prefer "Not being able to collide" and "Being able to collide". ...
0
votes
0answers
13 views

Phaser P2 RevoluteConstraint motor not working

The following code produces a flipper and four balls that seem to interact as they should. They all collide with each other and the game world bounds. The problem is that the motor isn't working, nor ...
1
vote
2answers
196 views

Dynamic navigation mesh generation algorithm

I'm working on a 2D game (top down / zelda like view) I'm struggling with navigation mesh generation, in complex scenarios my homemade algorithm is lost and too slow... I would really love to see a ...
2
votes
1answer
49 views

Unity, how do I pause the Audio in the Level? [closed]

I wanna pause the Audio if I press the Pause Button also, I need help.. Pause Script: #pragma strict var pausemenu: GameObject; public function pause() { pausemenu.SetActive(true); ...
0
votes
0answers
31 views

Access Unity Webgl output from browser and vice versa

I receive a package of Unity webgl and put that into a course in Wordpress. The index.html produced form Unity is accessed inside an iframe there. This must be able to count user click when accessing ...
0
votes
0answers
26 views

Movement prediction on client

Im pretty new to game development. Currently I try to predict the movement of the player on the client. But my client and my server are calculating different values. Im using a delta time for the ...
1
vote
1answer
58 views

Should I use the pathfinding client side or server side? [closed]

I'm developping a game where the user can walk in a room (with the others players). There are some obstacles that blocks the user. I'm using a Javascript pathfinding library to find where the user can ...
0
votes
2answers
33 views

Updating code to include states

The Problem I am having a problem in that I am finding it hard to understand how to update my current code so that it uses states. I am creating a game, the game has a menu, each page in the game ...
0
votes
1answer
29 views

How does this point2LineDist() method works?

I was browsing Wolf3D JS port and bump into that method : /** * @description calculates distance between a point (x, y) and a line. * @memberOf Wolf.Math * @param {number} x X coord of point * ...
0
votes
0answers
36 views

Chrome Canvas bug on Mac OS X when switching spaces?

I have a simple Breakout clone created using the <canvas> element and the 2d context. Whilst playing the game in Google Chrome (version: 49.0.2623.87 (64-bit)) if I switch spaces within Mac OS ...
4
votes
4answers
191 views

How decoupled should game logic and rendering be?

From a data perspective, how decoupled should game logic and rendering be? How much does it have to know about each other? Take a look at the following example. I'm going to use javascript because ...
0
votes
1answer
21 views

Oscillating an object left and right based on it's current orientation

I'm currently implementing a fire animation in HTML5 Canvas using the phone's accelerometer. Regardless of the phones orientation, the triangles for the fire move upward. So you can spin your phone ...
0
votes
1answer
75 views

2D Animated Tile rendering

The current game I've been working on needs to have animated tiles. I have a code for Tile and TileMap from my previous game that I recycled. However, it does not support tile animations. The tile ...
1
vote
1answer
43 views

Does pausing the canvas draw restores the FPS to higher value in a HTML5 game?

I set Frame Per Second of 60 for my game. But after 1 minute it gets to a significantly lower value - around 8 FPS. Does pausing the canvas drawing restores the FPS to higher value? If it does, how ...
0
votes
1answer
76 views

Can I use JavaScript for Unity 5? [duplicate]

Sorry for my bad English. I wanted to know how similar is JavaScript with Unity Script. I know that Unity Script is not JavaScript and it was done for marketing purposes but I just wanted to know if ...
-1
votes
2answers
124 views

Inconsistent AABB collision detection

I'm making an endless jumper as my first game and I'm running into some problems with the one-way collision detection. Collisions are detected correctly most of the time but occasionally the player ...
1
vote
1answer
58 views

Java - Adjusting the speed of an object during movement

I am trying to get an object to move (on java canvas) in the same angle but at different speed within the X and Y axis. Below you can see how i have implemented the movement of the object. xPosition ...
0
votes
0answers
30 views

Circular motion

I'm working on a to-scale simulation of the Solar System with HTML5 Canvas but a problem appeared which I am unable to solve. All the astronomical objects I've added have a point-of-reference (i.e. ...
0
votes
1answer
63 views

Efficient way to store entities in javascript

I am trying to design a game from strach with Javascript. It's a 2D game (a kind of Zelda on old devices). I am trying to find an efficient way to store my data because I know I will have to face ...
0
votes
0answers
10 views

Adding calls to an Entities update function

So I am trying to add a property to my entity function then in order for it to update I need to call it within the entity's update function so this is how I create the entity var sprite = ...