"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

1
vote
0answers
33 views

Combining Two Sets of JavaScript

So I am fairly new to programming and I am trying to learn by making a simple game. I watched to different videos on ray cast shooting and one of them has code for bullet hole decals that I wanted to ...
3
votes
1answer
58 views

Timers and performance for mobile JS

I'm using the Three.js JavaScript library to do some things in WebGL, and I wonder how the graphic aspects of timers are done on mobile. I was creating numbers with geometries and just replacing them ...
2
votes
0answers
45 views

How would I add a sound variable to my code?

I am writing some code in JavaScript for a ray cast shooting program. I have all the variables I need except for sound, and I'm not too sure on how to add that variable into my code. I would really ...
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 ...
-1
votes
1answer
81 views

How do I show the ranking images at winning post?

I am working on a racing game in Unity3d and I have to show the rank as the winners touch the winning point. As the winners reach at the winning point the image of the winner number should pop up for ...
0
votes
0answers
34 views

Canvas - Cache large curves

Is there any way to cache large curves in javascript or a faster way than the native? I'm already caching scalable shapes, and it gives really huge performance benefits. They only get redrawn if they ...
1
vote
2answers
75 views

How can I minimise memory thrashing when doing vector math in JavaScript or ActionScript?

Please note that a similar question has been asked before in the context of C#. Say I'm building a 3D game in Javascript or Actionscript, and doing a lot of 3D vector math. In current libraries, ...
1
vote
1answer
89 views

Javascript - How and where to put game initialization data

I'm new to JS game programming. In the past, when coding games (in Java), I tend to make separate files for configuration and game data (maps, character stats, etc). This is for separation of code and ...
2
votes
0answers
57 views

Phaser: Shader Chain

I want to implement lighting via shadowmaps. I see process as: 1) render something to RenderTexture1(size as game) 2) create RenderTexture2 (custom size) 3) add it to Image2 (custom size) 4) apply "...
4
votes
1answer
303 views

How can I set 3d sound to my game in unity5?

I have been working on a racing game in unity5. Now I want to set 3d sound so that if the game objects are far away from and coming towards the camera then it sounds like began to attenuate and then ...
7
votes
4answers
399 views

Interpolation using cubic Bezier curves

I am trying to create an interpolate function for an animation library to achieve a tweening effect between frames. I want this to work with Bezier curves. I have created a jsFiddle (here) of my ...
6
votes
1answer
295 views

In JavaScript, should I write a game loop for a turn-based game?

I am using javascript and HTML5 canvas for turn-based games (e.g., checkers, mastermind, minesweeper). Should I write a fixed-timestep game loop? What are the alternatives?
1
vote
0answers
38 views

Collision detection for multiplayer game with MatterJS

We are developing JavaScript multiplayer top down game where characters can move freely and collide with each other. We are rather weak at mathematics and physics, luckily we don't need much, just ...
0
votes
0answers
43 views

How to disable LockTexture for new level in unity?

i am building a game consist of 8 level. I use the following script to switch next level. But when i unlock a level the Lock Texture still remain in the window. I want to remove the lock texture when ...
0
votes
1answer
71 views

Is it bad practice to for the server to request data for a client from another client?

I'm making a collaborative whiteboard app so that when someone is drawing and uses a rectangle for example, a rectangle packet is sent to the server with parameters like x, y, width, height, color and ...
0
votes
1answer
82 views

Can I use sin or cos for the non uniform rotation in unity 5? [closed]

I have few objects which I have to rotate on an ellipsoidal track and speed is changeable at the run time because its a betting game in which racing will be done so speed values will come from the ...
0
votes
0answers
73 views

How do I use Bezier Curves in unity?

I have to rotate few objects on an ellepsoidal(Capsule shaped) track and at the run time speeds are assigned to the objects from the server as this is a betting game which I am developing in Unity 5 ...
0
votes
0answers
85 views

How do I rotate an object on iTween path on a curved track in Unity 5?

I have 10 objects which I have to make run on an ellipsoidal track for which I am using iTween PutOnPath. The objects are running on the track but as the curved track comes the objects do not rotate ...
1
vote
1answer
71 views

Tween - keeping a constant velocity at different distances

I am using a tweening library to move my units around. The problem is that the speed varies depending on the distance that the unit has to move because of the tweening: var time = 1000; var tween = ...
0
votes
0answers
48 views

Input management with context mapping for javascript game (I need a boilerplate code sample)

I have been working on an entity component system latelly and now it is time to add input management into the mix. I have read through a few tutorials about input management and as far as I understand ...
2
votes
0answers
89 views

tilting image for mode7 game in HTML5

I'm making a mode7 game like mario-kart and I need to tilt the image before I draw it, I have tried using a buffer canvas to tilt the image then draw it on the games canvas but this makes it laggy (...
0
votes
1answer
462 views

How can I export a model from Unity to three.js?

I want to buy some assets from the Unity asset store and use them in my three.js project, but I am not sure what the best way to go about this is. Some cursory googling got me this, but Collada ...
1
vote
2answers
511 views

How to Access MouseLook In Unity 5 with JavaScript

I'm following a tutorial to make a horror game. In the 8th tutorial I got stuck with the Mouselook option, he is using an other version of unity and I'm using Unity 5. In Unity 4, MouseLook was a ...
0
votes
0answers
132 views

How do I change iTween values at runtime?

I am trying to figure out how to run and change the speed of rotation on an iTween path at runtime. I'm trying to code it in Unity5 in C#. I have to rotate a few objects on an iTween path which I have ...
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 ...
0
votes
0answers
88 views

How do I Make an object run along with the the rectangular circle shaped path using iTween in unity 5?

Actually I have to rotate an object using iTween or usnig any other stuff if u know. Its like a betting game which I have to manage at run time. As I have been working on this game and have used ...
0
votes
0answers
23 views

How can I give rotation angle to an object running on iTween Unity5?

I have to rotate an object around a circular track which is a rectangular circle so for that I am using iTween and it is running perfect but the object does not change its own rotation just only runs ...
-2
votes
1answer
124 views

How to make a stab function?

I've looked around everywhere, and I can't find an example script for a stab. What I have so far is a top down 2D scene, with a player at the bottom (static). I would like to have the sword/tongue to ...
0
votes
0answers
17 views

How do I handle or manage commands which are sent by server in unity?

In my game there are 10 objects which are just started running on play as this is a web player game and betting as well and it requires some socket programming. At run time the commands are sent by ...
1
vote
1answer
497 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 Assets/...
2
votes
0answers
38 views

Why does interactive cloth not appear in game view in unity5 Pro?

I used interactive cloth fir flags in unity5 Pro version and it appears in scene view but does not appear in game view while playing. What can I do for that please somebody help me out?
0
votes
1answer
192 views

three.js objects disappear

I haven't got a lot of experience with 3D Frameworks - but was playing around with three.js and came across something that (to me) is a bit odd and I wondered why this happened. I am rendering the ...
1
vote
1answer
98 views

A* Pathfinding math for 2D, oblique style game

I'm making a 2D, oblique-styled RPG game and am implementing A* pathfinding for NPCs. The game is on canvas, using melonJS engine and sprites not confined to a 'grid'. I'm having a hard time ...
0
votes
1answer
79 views

TypeError: R[o5R.F6s] is not a function in changing states in phaser box2d

i build my game using phaser.2.4.3.min.js and phaser.2.2.2.box2d.min.js When trying to change states this error is being raised TypeError: R[o5R.F6s] is not a function and i can't seem to figure out ...
2
votes
1answer
998 views

How to remove a component of an object in a script?

I want to remove a Sphere Mesh Renderer component from a certain gameobject. I want to do this in a script. How do I do it? I do not want to destroy the sphere itself, just the component
0
votes
2answers
1k views

I need an object to move towards an moving object in Unity2D (javascript)

I am trying to make an AI that tries to move towards the player but I don't know how. I tried using Vector2.MoveTowards() but it just mimics my movements instead of moving towards the player. I tried ...
0
votes
1answer
104 views

How to get a Vector2 location of an object? (Unity2D javascript)

I need to make an "AI" that makes a ball try to touch the player. But Vector2.MoveTowards()needs a Vector2 variable but how do i get the location of an object?
0
votes
1answer
41 views

How to use rigitbody2d.AddTorque() in JavaScript? (unity2D)

I just want to know how to use rigitbody2d.AddTorque() and an example script would be great :D. I am trying to rotate a cube forever using it as a test.
2
votes
1answer
177 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 ...
2
votes
1answer
239 views

Calculate the slope of a 3D triangle?

I have lots of triangles in 3D space. How do I determine the slope/angle of these triangles with respect to a fixed ground plane? I need pseudo code examples at the very least. Thanks! [edit] Based ...
2
votes
1answer
673 views

JS Canvas - Creating 2D Game lighting effect like Terraria

I just started working with canvas in HTML5 and with javascript. I'm pretty satisfied with my game so far: http://xenopal.dk/game-v1.1/. But I'd like to implement lighting as well in the style of ...
10
votes
1answer
314 views

How can I implement lights & shadows in a multi-layer 2d tilemap?

I am in the process of writing an isometric game from scratch, and I'd like to know how/if I can add lights and shadows. The code I have so far can be found here, but it should be enough to know that ...
1
vote
1answer
44 views

How can I create a parabola that does not use negative X coordinates

I am currently devloping my first javascript program ever which is a table tennis game. I am trying to create trajectory for the ball to follow when hit - just a very basic parabola. However im not ...
0
votes
1answer
174 views

How do I make the background color fade into a different color after hovering it? [closed]

I was trying to make the starter inputs for my text rpg change the background color in a fade effect with JQuery, but I cant figure out what i did wrong. Heres the part im focusing on: <script&...
2
votes
1answer
254 views

Animations with individual images in Phaser.js

So I have this game that I made a while back and I want to port it using Phaser. The game is made using individual PNG files for all the animation frames, and there are over 100 of them. From ...
1
vote
2answers
127 views

Using hard coded values for Items?

Is it a bad idea to use hard coded values for things like items (static data) that would change infrequently in an online game? I'm designing an online game in node js, and I'm trying to decide if it ...
1
vote
1answer
170 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
100 views

Using EaselJS, my spritesheet-based map is not showing up

I have a random map that generates based on a level and a set of Tile ID's, constructed using a Height Map generator I wrote using the BitmapData extension. I've confirmed that the Tile IDs are ...
0
votes
1answer
67 views

How do I combine two HTML levels? [closed]

If I have two levels that I have made separate in HTML5 how may I combine them so one comes after another?.
3
votes
1answer
211 views

Creating HTML5 Canvas Objects in Javascript [closed]

I'm currently trying to learn how to make HTML5 Canvas games with JavaScript. I would like to use object oriented JavaScript to manage the elements of the game, but i'm having trouble. I've done a lot ...