"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

2
votes
3answers
229 views

How do I correctly make character sprite direction match player inputs?

In my top down game I can move the character around and the character will even face the direction he is moving. However, there is some weird behavior I'm having: when you hold down one direction and ...
4
votes
2answers
487 views

Where and how to promote an HTML5 game engine? [closed]

I've recently completed an engine, called Irenic. Now, I was wondering, how could one promote it? The process surely is different than promoting a game, because a game can be played by almost anyone, ...
0
votes
1answer
186 views

Resizing a tiledmap when using phaser

var cw = window.innerWidth; var ch = window.innerHeight; var game = new Phaser.Game(cw, ch, Phaser.AUTO, 'game', { preload: preload, create: create, update: update }); ...
1
vote
2answers
34 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
0answers
20 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 ...
2
votes
1answer
175 views

How should I store dynamic game entities for efficient area-based selection?

In my 2d block-based game I'm trying to implement a data structure that would store entities entities in a way that's capable of: Direct selection based on coordinate. Iteration Iteration limited ...
1
vote
1answer
54 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
0answers
46 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
2answers
58 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 ...
3
votes
1answer
58 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 ...
1
vote
0answers
74 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 ...
0
votes
0answers
20 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
84 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
0answers
30 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
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
19 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
21 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
29 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 > ...
0
votes
1answer
28 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
93 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 ...
2
votes
1answer
83 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 ...
1
vote
2answers
109 views

How do I use delta-times to determine the speed of a frame-by-frame animation?

I have a character spritesheet with 8 images. How do I animate it? At the moment, the sprite changes to a different image every frame, which makes the animation speed vary with framerate. I have a ...
1
vote
2answers
214 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 ...
1
vote
0answers
33 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 ...
10
votes
3answers
1k views

Saving roguelike game state?

I'm working on a basic roguelike using HTML5 and jQuery, and I've come across a problem. The way the game currently stands, the system only saves the game state every time the user moves between ...
0
votes
0answers
22 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
35 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
10 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 ...
0
votes
0answers
24 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 ...
2
votes
2answers
3k views

HTML5 point and click adventure game code structure with CreateJS

I'm a programming beginner. I made a tiny one scene point and click adventure game to try to understand simple game logic and came up with this: CreateJS features prototypes for creating bitmap ...
-1
votes
2answers
127 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
0answers
57 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
14 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 ...
0
votes
1answer
42 views

How to display a lot of small objects using WebGL?

Introduction The game scene contains a lot of 10x10 pixel elements: for 1980x1200 px. screen the number of elements on the scene can vary from 0 to 23760 (elements cannot intersect). The live ...
2
votes
1answer
57 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); Time....
4
votes
4answers
215 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
0answers
32 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
28 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
67 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
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
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
0answers
41 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 ...
0
votes
2answers
755 views

How legal would it be to use some elements of the Half Life universe in my non comercial, indie game?

I'm planning to make a simple, HTML5 game, that would use some elements of the Half Life universe. Basically, it would be a 2D Portal clone, but it would have it's own story, and portals would be ...
0
votes
1answer
77 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 ...
0
votes
0answers
84 views

Using canvas graphics instead of traditional sprites in phaser

I'm trying to learn Phaser (total beginner with mild JS experience) and I'm following tutorials and such where everything is using sprites. I'm trying to get by with basic canvas shapes instead of ...
2
votes
1answer
174 views

JavaScript 2D liquid flow

Brand new to games/graphics and I'm attempting to find a method to create a 2D liquid effect with JavaScript. Ideally I could adjust the viscosity and flow from a gas/fog effect to oil and between. ...
0
votes
1answer
55 views

Javascript 2D game tile textures

I am using a texture atlas for my tiles. Of course I need to get the sub-images to draw them on the canvas as separate tiles. Right now I can think of two ways to implement this. Divide the texture ...
1
vote
1answer
45 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
64 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
1answer
85 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 ...