"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
15 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
1answer
23 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
0answers
10 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
43 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: { ...
0
votes
1answer
696 views

How to use Cocos2dJS to connect to a Socket.IO server?

How can I connect to a nodejs socket.io server from a cocos2djs game? I've google all the way to no avail. I tried this but it does not work: socket = io.connect('http://192.168.254.102:7714'); if ( ...
1
vote
2answers
70 views

Help with Javascript touch button

I tried many buttons but I can't connect them with the (Java)Script. So I made 2 gui buttons: one for jump which was easy because I have an if statement and if it's true then jump. But I have ...
2
votes
1answer
170 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
44 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
85 views

How do I sync the gameobjects to server in C# unity?

I have been working on Game that consists of 10 Game Objects that have to be sync by the server values. The server decides that which game object will win and then sends command to my side(Client ...
2
votes
1answer
153 views

Centering camera on player div

I've been making a roguelike-style game in HTML5 without using canvas (only divs) with pure JS (fiddle!). I've been trying to enlarge the tile size (font size) while keeping the player centered within ...
0
votes
1answer
60 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
1answer
34 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
2answers
248 views

Saving data in the local computer with cocos2d-js

Making a game with cocos2d-js, is there a reliable way to create saved data in my local computer? I see that there is cc.sys.localStorage but it is removed if the user clears the browser's cache or ...
0
votes
0answers
40 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 ...
3
votes
4answers
445 views

In PHP, how do I implement multiplayer “rooms” for a turn-based game?

I'm working on a multiplayer checkers game. I want to let players choose another connected player and invite him to play. I have a working game engine and rendering, but I'm stuck on the multiplayer ...
1
vote
2answers
56 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 ...
1
vote
1answer
65 views

Color Based Collision Javascript (Cocos2d-js)

Im looking to make an isometric game...so my partner designed the isometric map (jpg image) along with the map objects (png) on adobe ilustrator... so the thing is i would like to set the player path ...
3
votes
1answer
52 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
61 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
13 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
16 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
2answers
89 views

How to make the character cannot pass through other randomly moving objects when they are collided?

As the title above, how can i make my random wallImg solid enough so that my birdImg cannot pass through it from any sides of the wallImg? Here's the code of Processing's Crappy Bird that i've altered ...
3
votes
2answers
474 views

Collision detection between draggable object and world objects?

I have a game I'm making in Javascript that will involve combining items by dragging and dropping them onto each other. Think Alchemy or similar. So far, so good, but I hit a snag while trying to ...
0
votes
1answer
81 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
27 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
25 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 ...
1
vote
1answer
161 views

Drawing/adding shape objects with the mouse on html canvas

I've started with the canvas paint tutorial from link which worked fine with a few problems that can be fixed later. I've been checking a lot of posts on drawing shapes on the canvas but they all use ...
0
votes
0answers
11 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 ...
3
votes
1answer
97 views

Call a native mobile API in Construct 2?

It is possible to use mobile api features in a Construct 2 game (html 5 / js engine) ? I didn't find anything about that on the net, unlike anothers game frameworks like Corona Entreprise or ...
1
vote
1answer
404 views

Create a WebGL native plugin

I am trying to create a WebGL plugin and I read in the docs here: http://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html But I'm not sure I understand. I created a file in ...
3
votes
1answer
383 views

Shadows in html5 canvas game

I'd like to ask for reference. I met an article about how to cast shadows in games. I'm using html5 canvas (currently without webgl) with javascript for my projects. The article mentioned above is ...
0
votes
0answers
15 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 ...
3
votes
1answer
91 views

PhysicsJS on mobile devices: how to optimize for speed

I'm (physics n00b) developing a small animation (gamification) in a mobile HTML5 app (PhysicsJS, HTML5, Cordova, Ionic, JavaScript). This animation is derived from Basket of verlet constraints. This ...
0
votes
0answers
26 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 > ...
2
votes
3answers
208 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 ...
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
1answer
217 views

How can zoom into my object when that object is being clicked?

Suppose that I have the three game(cube,Quard,sphere) object. When I click on a particular game object suppose think I have clicked on the cube,the cube object should get zoomed in on the screen. how ...
0
votes
1answer
181 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 }); ...
0
votes
1answer
43 views

Hybrid App - Game Encyclopedia Image Asset

An in-game encyclopedia usually consists of entries and images for things related to the game. For example, pokemon's pokedex. Image of Pokemon, text description and so on. I've happen to encounter a ...
0
votes
1answer
29 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 ...
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 ...
2
votes
1answer
61 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
107 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
192 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
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 ...
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
17 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 ...
0
votes
0answers
20 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 ...