"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
1answer
12 views

Dealing With Multiple requestAnimationFrame Calls

I am having issues with requestAnimationFrame calls stacking on top of each other. I am developing a platformer game, which has three separate functions that need animating (main menu, cutscene, in ...
1
vote
1answer
23 views

Image Not Loading Crafty.js

I am experimenting with Crafty.js, and I have called .image() on an entity, and the image is not loading. When I look through the web inspector, I can see that the cloud entity exists, and that the ...
1
vote
0answers
19 views

Allowing one sprite to move through another in Quintus

I have a Bumper class extended from Sprite: Q.Sprite.extend("Bumper", { init: function(p) { this._super(p, {gravity: 0}); this.add("2d, ... //etc. } I have an Enemy class that ...
1
vote
0answers
35 views

Resizing the map in HTML5 canvas

Say I have a big map for my HTML5 game. And it is drawn with an image repeatedly. I want my map to be able to resize and respond to player's behaviors. Now I can resize my map, I just multiply a ...
1
vote
0answers
19 views

Pixel Check With Node.js

I'm trying to check if a pixel of a certain color at (x,y) has moved within a boundary of [(x1,y1),(x2,y2)] and also update its new position to console. I'm doing this as a desktop application so no ...
1
vote
1answer
61 views

Tile Based Collision With Moving Platforms

I am developing a platformer using pure HTML/Javascript. After remaking my collision detection system with help from HTML5 platformer collision detection problem, I realized my moving platform ...
3
votes
2answers
97 views

What is wrong with my Chest script?

I'm making an RPG in Unity3D and I am trying to make a script for a chest to open. So I built this script! But it doesn't work. I just want some help fixing this script. #pragma strict var Text : ...
1
vote
1answer
20 views

How to FIX Phaser Idle Clicker Game Images?

I'm new in game development Phaser.. I'm trying out a code tutorial for a clicker game I browsed from Zenva and did a few adjustments with the images (along with the codes) but I can't help to notice ...
0
votes
1answer
27 views

Updating bots/AI behavior after a fixed elapsed timestamp in game loop?

I am developing a HTML5 game in javascript. Now I have created a few bots and they should be able to change their orientation after a few seconds/a fixed timestamp in the game loop. Suppose my game ...
0
votes
1answer
32 views

How to kill a fired bullet sprite after certain amount of time in Phaser?

The bullet should be killed after it was shot from the player, and after a certain amount of time. function create() { bullets = game.add.group(); bullets.enableBody = true; bullets....
1
vote
0answers
24 views

Optimize field of vision algorithm in a grid tiled map

I am trying to implement Field of View algorithm in my game and I followed the great tutorial here : sight-and-light and here is what I got so far : As you can see it works fine for me :) And then ...
1
vote
1answer
38 views

Unity error converting quaternion to euler rotation

When I try to run my game in unity, it comes up with the error: No appropriate version of 'UnityEngine.Quaternion.Euler' for the argument list '(UnityEngine.Quaternion)' was found. When using the ...
0
votes
0answers
17 views

Phaser P2: Sprite has movement after body.reset()

I've got a side scroller game and a sprite as player char. It can collide with enemies and dies instantly. So when I reset the game to play again, the player char has sometimes a velocity, and I don't ...
-3
votes
0answers
16 views

Mouse coordinates to Isometric world coordinates [duplicate]

How can i convert mouse position to isometric world coordinates? I was searching answer on internet, but their solution did not work.
3
votes
1answer
18 views

Calculating the poly vertices based on the result of Connected Component Labeling

I am making a tile based game. And now I can find all the connected area using the Connected Component Labeling algorithm. But now the problem I am having is how to calculate the poly vertices of ...
1
vote
2answers
45 views

Rotate directly towards a target at a constant speed

I've written a program (see on JS Fiddle) that rotates my player towards the mouse cursor at a constant speed. I've computed the angle to the point using the Math.atan2 function, but when incrementing ...
1
vote
1answer
30 views

Rotated Sprites collision detection

I am trying to implement checkCollision function in my game, I used AABB method but the problem is that my sprites are rotated so it's not really precise. I could finely describe my Sprites with ...
1
vote
0answers
18 views

How to communicate with LibGDX HTML5 app?

I'd like to have a HTML form send data to a LibGDX game deployed as HTML5. Ideally as a form in HTML as part of the same page that contains the LibGDX div/canvas, and use the form to set up some data ...
3
votes
1answer
49 views

Point plotting with a line graph

Please see attached screenshot. Here's how it works. A is a slider that goes up and down, and the red line uses the centre point of the A slider to draw its start point. B is another slider, but ...
1
vote
0answers
5 views

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
23 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 ...
1
vote
1answer
52 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 ...
-4
votes
0answers
50 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
2answers
36 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....
1
vote
1answer
71 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 ...
1
vote
0answers
31 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
50 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
0answers
29 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 (...
-4
votes
1answer
33 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 ...
1
vote
2answers
105 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 not sure how to go about it in this case. Here's the game http://cssdeck.com/labs/ping-pong-game-tutorial-...
0
votes
0answers
37 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
40 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
0answers
29 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
26 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
38 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
0answers
46 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 ...
0
votes
1answer
33 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
1answer
90 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
1answer
47 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 ...
0
votes
0answers
53 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

js canvas tiled map - for loop, while, or matrix

I am making a top-down view tiled map in canvas, where player is always in the middle of the screen, and map scrolls depending on where you go, like in moba games. I also want it to loop infinitely in ...
1
vote
2answers
124 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
1answer
23 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
1answer
51 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
46 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
22 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
49 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.
1
vote
1answer
84 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
55 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 ...