"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
1 view

Detecting collision between browser window middle point and other sprites visible in the window

In HTML5 canvas, I have an object which is always in the middle point. On the big map there are other moving objects. I want to detect if the middle point of the window hit any shape we see on the ...
0
votes
1answer
189 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
13 views

How to create a random array of Transforms and Instantiate the random item?

I'm trying to make a rock that after you break it, it will spawn a random item from the minerals array. How can I pick a random item from the minerals array and then instantiate it? var ...
0
votes
0answers
26 views

ThreeJs camera angles [on hold]

I'm trying to build a 3D editor for my game. What I'm trying to achieve is an IDE similar to the most part of 3D modeling softwares (Blender, 3D Max, Maya, etc) where you can choose the camera angle ...
1
vote
1answer
35 views

Difficulty aligning isometric tiles

I'm trying to render isometric terrain in javascript. Currently, my tiles are being drawn with small gaps between them: I want the tiles to line up with no pixel gaps in between: My rendering ...
2
votes
3answers
231 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 ...
1
vote
2answers
33 views

Object is moving more than it should

I have the following code for Food: exports.Food = function(x, y) { this.MOVE_X_FROM_POSITION = 10; this.ACCELERATION = 0.05 this.image; this.firstX = x; this.firstY = y; this.x = x; this.y = y; this....
-4
votes
0answers
37 views

Isometric social games. Click to tile

In the Social Isometric Games book, page 53, there is a description of the method, that defines a title using mouse cursor coordinates. It works well, but it is not clear what principles are used to ...
1
vote
1answer
955 views

WebGL: Texture appears as black

I have a simple WebGL canvas, where I'm attempting to render a texture on a square. When working with textures as local files, all is fine. But when I try to load a texture from the web, I get a black ...
0
votes
1answer
44 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 ...
-1
votes
0answers
21 views

How do you understand Unity3d Scripting errors? [on hold]

So there are these things in Unity called "Compiler Errors" which is a message you get if you have an error on a JS or C# script, it would also "Give you an explanation" to what's wrong with it, I ...
2
votes
1answer
263 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
0answers
21 views

Creating new browser multiplayer game

I decided to make an browser-based multiplayer game with huge armies. So far in a year i have created an army editor, where you can create armies, place then anywhere, set several moving targets and ...
0
votes
1answer
48 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
104 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 side)...
1
vote
1answer
62 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 ...
1
vote
1answer
73 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 ...
1
vote
1answer
83 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
0answers
27 views

p2 collision not working after state change

i have 2 objects GAME.ball Game.stick both have two bodies and i have two scene first scene GAME.ball = game.add.sprite(x,y,key) game.physics.p2.enable(GAME.ball, true); GAME.ball.body.dynamic = ...
0
votes
1answer
742 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
1answer
61 views

What's wrong with my animation trigger script?

So I am making an RPG and I am setting up the player. I am trying to trigger an attack animation by pressing a button. I wrote this down and I get an error that says "Expressions in statements must ...
0
votes
2answers
297 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 ...
1
vote
2answers
79 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
160 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 ...
1
vote
0answers
23 views

how to replace vertex buffer in webGL

I want to replace a vertex buffer with another completely different vertex buffer, different size and values, it will not get replaced every frame. gl.deleteBuffer(vertexBuffer); vertexBuffer = gl....
-1
votes
1answer
48 views

What does this code mean? [closed]

I got some code from here http://www.williammalone.com/articles/create-html5-canvas-javascript-game-character/1/ Everything is quite understandable, everything working well. However, I don't ...
1
vote
2answers
72 views

How to make Pong ai paddle?

I'm trying to make an ai so the paddles will move to position before the ball reaches it. I'm currently using RobotJS to move the mouse. I'm not sure how to extrapolate the position so that the mouse ...
-4
votes
1answer
31 views

Stuck with matching problem

i am making a game in Javascript called bubble shooting and this is a time based game the bubbles will spawn on the top of screen and will travel to bottom and i am stuck in bubble spawning because i ...
0
votes
0answers
23 views

Jumping on meshes in Babylon.js

So I want to make it possible for players to jump on objects (meshes) that are somewhat lower than the players camera. I have set the checkCollisions to true but i can't seem to jump on any objects (...
3
votes
4answers
489 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 ...
0
votes
1answer
51 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
34 views

Drawing strings with a fabric texture in Javascript - possible?

Am exploring ways to programmatically generate string arts (sort of like these physical examples: https://goo.gl/d2Gyeg) in the browser. Any gurus out there that can help guide this exploration down a ...
2
votes
2answers
35 views

Handling input through callbacks or through game loop?

I've tried to figure out how to handle player input properly, but without luck so far. As far as I have figured out, I can either: Call the respective methods directly through the callback fired ...
0
votes
1answer
37 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 ...
1
vote
1answer
78 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 ...
0
votes
2answers
893 views

How to move an image back and forth with javascript

I currently am trying to make a baseball game and have this code here: http://jsfiddle.net/769BK/ I have the baseballX set to a decrement, and then I try increasing the value using baseballX++; but it ...
0
votes
1answer
24 views

How to draw and give functions to multiple things at once?

I'm using plain JavaScript and I've bee coding a hardcore platformer game. I want there to be multiple enemies at once and before I write up the code I have a question. How do i approach that? Do I ...
0
votes
0answers
25 views

Floor casting in a Raycasting engine

I'm trying to create a pseudo 3D, raycasting engine with plain JavaScript rendered on the HTML5 canvas. In short: a Wolfenstein 3D clone. So far I have gained inspiration from the following guides: ...
0
votes
1answer
35 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
0answers
41 views

Multiplayer game server sync

I am building a 2d multiplayer game with no physics and my own authoritative server. Already have all players getting synced each with other but their movement isn't so smooth yet. Here is the ...
3
votes
2answers
492 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
2answers
2k views

Simple javascript HTML5 canvas start menu

I'm currently looking for a simple and basic start screen for a game using javascript, so basically its the first function that is called and then press play which then goes into the game. Looked ...
0
votes
1answer
30 views

How to make Pong Ball Control?

I want to know how can I make the control of the Pong Ball in Plain Javascript. I would like to know how to make the ball faster when it hits the edges just like the original pong game, or how if the ...
0
votes
0answers
23 views

In JavaScript, Should every object have its own draw method? [duplicate]

Up until now, whenever i make a game in JavaScript I had been giving each prototype its own draw Method. I used this paradigm because giving every method a draw method allows for simple interaction ...
0
votes
2answers
99 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
414 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 ...
9
votes
1answer
2k views

Implement Fast Inverse Square Root in Javascript?

The Fast Inverse Square Root from Quake III seems to use a floating-point trick. As I understand, floating-point representation can have some different implementations. So is it possible to ...
0
votes
1answer
81 views

Why does the player jump every time it touches the ground in my JavaScript game?

I am making a javascript game where the player jumps over oncoming cars, but after the first jump every time the player hits the ground they jump again automatically. I believe the problem is because ...
0
votes
0answers
52 views

Collision detection not working for JavaScript Game

I'm working on a JavaScript game called Spacecraft which is minecraft 2d style. The problem is that my collision detection is not working. It works for a all the divs but the ones with the class of ...
0
votes
1answer
43 views

How to calculate a simple swivel rotation? (no physics engine)

Assuming i know the geometry and the rotation angle of a cart, how can i calculate the rotation angle of a swiveling wheel? To get the rotation angle of the wheel, i tried by calculating the ...