"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
11 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
32 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
129 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
87 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
45 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
67 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
258 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
35 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
71 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
22 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
47 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
788 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
0answers
87 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
192 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
57 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
65 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
101 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 ...
2
votes
1answer
235 views

Separation of axis theorem implementation at normals

This might be more of a math question, but it relates to the development of a simple physics engine I am trying to create. I have been stumped on this for about a week now, and have been unable to ...
1
vote
1answer
98 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
34 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
0answers
12 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 = ...
1
vote
1answer
90 views

How should I efficiently clear and redraw my canvas with lots of animated sprites?

My current solution is to clear the entire canvas and redraw all sprites on every requestFrame(). This works but feels inefficient: I only need to clear the part of the canvas made invalid by ...
0
votes
0answers
21 views

JavaScript — Unity Movement Bug

Hello fellow programmers ! I have been working on a game lately and It's going pretty good. Today I decided to make a new car for it since it's a racing game. When I was modelling the car I ...
0
votes
0answers
45 views

storing hexagon-based (x/y) movements in a database

Im developing a hex(agon)-grid based game. The game is turn-based. Players move stuff on the map and they need to be allowed to issue movement-orders. Units move a certain amount of movement-points ...
1
vote
3answers
1k views

Where to start, to develop an online Backgammon game? [closed]

I would like to develop a backgammon game to play against other players online, as a way of learning more Javascript/jQuery and a little game development. I'm a web developer and most of my experience ...
-1
votes
1answer
65 views

What JavaScript and or Html should engine I should use? [closed]

I took some classes on JavaScript and I know some html5. I took these classes so I can Learn Game Development!! I want to use JavaScript and not C# or C++ because I want easy cross platform with the ...
1
vote
3answers
599 views

Why cap game loop delta-time?

I was reading some game's source code on Github and saw this game loop implementation for the first time: var lastTime = 0; var maxTime = 1/30; /** * @param {DOMHighResTimeStamp} curTime ...
0
votes
1answer
66 views

Collision between free player and tilebased map

so I'm working on some sort of platformer in javascript where the map is tilebased but the player can move freely. Now, i have a problem with collision detection/response. It's kind of obvious what I'...
-2
votes
3answers
1k views

Objective-C or javascript+html5+canvas? [closed]

I'm really interested in starting to study some language with the idea of develop games for ipad and iphone. My main concern is that as soon as is possible to develop games with javascrit and html5 ...
0
votes
1answer
15 views

Mousedown event not performing drawImage

I've been working on the basic gameplay. I'm to a point where I think it should draw a card in the quadrant clicked/tapped, but nothing is happening. I can't see what's wrong. Please help. My only ...
0
votes
1answer
46 views

Why are my canvas drawings larger than the actual image?

For the following page source, I've finally gotten a grip on rendering the cards. I'm puzzled why they appear about 2.5x larger on the canvas. <html> <head> <style> ...
0
votes
2answers
53 views

Struggling to define js sprite sheet

I've been working on this for a couple days, unable to get anything to load. Here is the whole page. Please help me find what I'm doing wrong. Right now, I'm only trying to render the first card in ...
2
votes
3answers
168 views

How to center a tilemap in Phaser?

In Phaser, I am loading a Tilemap from JSON. I would like my Tilemap to display in a particular position (for simplicity here I say the middle of the screen). var map = this.game.add.tilemap('level'...
-4
votes
1answer
55 views

Can someone explain this function? [closed]

How does the spawn function work? var max_bollar = 15; var i = 0; var timecounter = 0; var bollarcounter = 0; var spawn_delay = 5; var min_spawn_delay = 25; var max_spawn_delay = 500; var balls = []; ...
-1
votes
2answers
40 views

How can I get information from a function

Okay, so if I use this code to randomly spawn balls at the top of the screen, how do i get them to move down: var max_bollar = 10; var i = 0; var timecounter = 0; var bollarcounter = 0; var ...
0
votes
2answers
85 views

How can i call a thing a lot of times (game: dodger)

Hey I am new to coding and i want to know how to get the same thing to hapen until i "say" stop. The game is that you need to dodge stuff that is falling, i was thinking that i could use a while loop ...
1
vote
0answers
82 views

Drawing a hexgrid on a canvas, yet making it zoom/scrollable?

I'm developing a game in JS / PHP. The game is basically a 2D plane (hexgrid) where each hex represents a location in space. In total, I'm drawing 25 * 25 hexes on a 1000x1000 canvas. I also draw ...
3
votes
1answer
69 views

How can I turn off the sound from another scene?

I attached music file to my first scene and thanks to following javascipt code, sound continues without stopping in other scenes. public static var object : SingletonMusic = null; function Awake() { ...
1
vote
1answer
49 views

How can I create a spacial grid? [closed]

I just created a tile map for my game, and its a side profile game. The game looks sort of like Terraria, where there is blocks you can place and break. I want the player to be able to collide with ...
1
vote
1answer
94 views

Align SpriteText position [closed]

i have this function which aligns text. static function AlignTxt(obj : GameObject, txtAnchor : SpriteText.Anchor_Pos, txtAlign : SpriteText.Alignment_Type) { obj.GetComponent(SpriteText).SetAnchor(...
1
vote
1answer
73 views

How do I deal with AABB sweep ghost collisions?

I've been trying to wrap my head around this for some time now. I wrote an implementation of AABB sweep collision detection. I though I understood the idea but it didn't work as expected. I rewrote ...
0
votes
0answers
14 views

Pixel collision detection between two images is not working in Phaser.js [duplicate]

I am applying collision between two images. But the two collided images are not taking the pixels to collide with each other. The collided images are overlapping each other but at some point, the ...
3
votes
0answers
110 views

Change color of bitmap

I am attempting to understand the easeljs ColorFilter and its use with cache. There is quite a bit of information at the easeljs site but it's not clear based upon the examples and documentation. ...
0
votes
1answer
61 views

Random equidistant points like a tree branch (JS)

I'm working on an algorithm to generate a "graph" like array of points in my game world. See Image Below: Here is what i'm working on so far, which will generate the black line.. but this may not ...
1
vote
1answer
34 views

how to follow(center) a box inside canvas element

If inside a canvas I draw a box, and the I add arrows to move it, the box will eventually be out of my reach since it goes out the border and I cant see it. How could I follow the box so that it is ...