Tagged Questions

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

Making my character jump [duplicate]

How do I fix my code? At the moment my character goes up for as long as you hold the up key. I want a more jump like effect where the character will drop back down when it reaches a certain height. ...
0
votes
0answers
33 views

Pathfinding in an one-dimensional array? [on hold]

I programmed the A* pathfinding algorithm for a bot in JavaScript. It works but it is not fast/efficient enough. The grid is one-dimensional and contains of 154 zones. For every zone I have a ...
0
votes
0answers
41 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
21 views

How to make speech recognition for a game? [on hold]

Is there anyway to make speech recognition in a game and/or just normal speech recognition where the program remembers what the user says, puts it a JavaScript variable, and responds?
0
votes
0answers
73 views

Best way to develop a Web based RPG game - after some research [on hold]

I've been researching this for a while, and I'm in need of some pointers(:D) the thing is this - I have 3 options in mind: HTML5 + Javascript Java applets(is that still a thing?) unity web player ...
0
votes
0answers
16 views

2D sprite tools which give coordinate mappings of each sprite pixel [on hold]

I am trying to build a mapping of any 2D sprite, such that the player can hover over various portions of the body, and a textbox pops up with the given part name, like so: I'm looking for a sprite ...
0
votes
1answer
44 views

2D Hitboxing on an HTML image [duplicate]

I want to make a turn-based game where the player is given "opportunities for attack." An image of the in-game sprite character appears when it's the player's turn to attack. The player can mouseover ...
0
votes
2answers
31 views

How to access bottom canvas layer in HTML?

I have such html: <div id="main_window"> <canvas id="canvas_hex_logic" width="200" height="100"></canvas> <canvas id="canvas_ground" width="200" height="100"></canvas> ...
0
votes
1answer
35 views

How do I cut off the edge of an image in a 2D JavaScript Array?

OK, I am trying to make a game that is a little bit like SimTower but utilizing HTML5 (particularly the canvas element) and JavaScript with a little CSS. I have ran into a couple of little problems ...
0
votes
1answer
48 views

Initial force to achieve orbital velocity

I'm attempting to get asteroid to orbit a black hole that is asserting gravity. Some parts currently work, like the black hole asserting gravity, attracting asteroids in and destroying them. And ...
0
votes
1answer
46 views

Creating looping canvas animation (slot machine with reels)

I have a small assignment to create something like slot machine with spinning pictures. I have to use HTML5 Canvas. I would like to hear some opinions how this can be made simply and performantly. ...
1
vote
0answers
17 views

Simple track method for 2D car game? [closed]

I'm a new programmer and I am trying to make a 2D car game on an html5 canvas with javascript and JQuery. I have got the basic car motion down, check it out here: ...
0
votes
1answer
36 views

Variable Variables in unity using JavaScript?

I'm working on a custom built save system for a project a friend an myself are working on. Currently all variables that are saved to file, are stored as static variables in a global variables script ...
-1
votes
2answers
61 views

Unity - Can't Shoot While Moving

Shooting does nothing while moving, but it works perfectly fine while standing still in my Unity project. As far as I can tell no one else has this problem. I just used the Character Controller first ...
1
vote
4answers
102 views

How do I make sure my tic-tac-toe AI always plays to a draw?

I'm working on a little project. The aim is to play Tic-Tac-Toe against an AI, but I require that the game always results in a draw against the AI opponent. How can I implement the AI to ensure that?
0
votes
1answer
34 views

Text width phaser.js

Does phaser have any function that returns the width of the text or if not, how can I center text inside rectangle I've drawn? Thanks!
0
votes
1answer
105 views

How to lock aspect ratio when resizing game window in unity?

I want a scalable game window that when resized stays at 16:9 aspect ratio. The goal is for the user to be able grab the window on the right or bottom and resize it. The game should adjust the ...
1
vote
2answers
43 views

Offset during zooming to keep object within boundries

I have a simple zoom feature which lets the user zoom in and out. I'm having an issue how ever when i zoom out the object gets smaller to the point that the boundaries become broken. The idea is the ...
0
votes
1answer
42 views

How does browserquest handle tiles above players

How does browserquest handle tiles above an player? For example: When the player stands in front of the tree. the player will be displayed on top of the tree. When the player stands next to the ...
0
votes
0answers
21 views

Processing.js for loop not executing all the way

I'm trying to add elements to an ArrayList (in Processing.js, basically a javascript array) in a for loop. BEcause of the many objects I need to add, the for loop is not incrementing all the way ...
0
votes
1answer
44 views

How to manipulate browser pixels on different mobile devices

I'm creating a board game using HTML5, CSS3 and JavaScript. It's working fine on Desktop browsers properly. But when i load it on Windows phone it's not behaving properly. The resolutions and the game ...
-1
votes
1answer
58 views

How to deal with extremly big numbers in javascript? [closed]

I am making a idle game like http://www.clickerheroes.com/ . I am doing it using createjs html library(doesnt matter). Anyways what i want to know is how i can deal with extremly large numbers that ...
1
vote
0answers
89 views

RPG game engine HTML5/javscript [closed]

I am planning to build a 2D RPG game (Zelda style). I am looking for a game engine that has the following features: Map editor to create maps (preferably orthographic grid), with solid objects, ...
0
votes
0answers
32 views

Balancing fight script in Text Based Javascript Game

I'm working on a little text based javascript game and I've been using chromes Javascript console for the output. The 'game' works off a series of methods written into an object called Player created ...
0
votes
3answers
83 views

Add a Countdown Timer that increments in JavaScript and resets per level(Resovled)

I am currently developing a Simon says type game using jquery and javascript. I have linked a fully copy of the game on github Github download and unzip to see the game fully ...
0
votes
1answer
25 views

Get speed from vector using box2d and javascript

I need to find the speed of an object in a game. The game is made in HTML5 with jquery and jquery.box2d. For this I can use these methods: GetLinearVelocity().x; GetLinearVelocity().y; I'm then ...
0
votes
1answer
63 views

How can I get a 4x4 matrix from a bullet quaternion?

I'm trying to make a game using JavaScript with Ammo.js ( an implementation of bullet ) and Sylvester to do my matrix maths. The problem is I don't know how to turn the WXYZ that bullet gives into the ...
0
votes
1answer
51 views

How to color each letter text in Phaser.js?

I have a text created with text object (game.add.text) and I would like to color each letter differently if that is possible. If not, how can I achieve this?
1
vote
1answer
63 views

using delta timing is causing shake

I am using delta timing to account for potential drop in frame rate. Only trouble being when I do this, I can notice an ever so slight wobble. I checked out the following JSFiddle coming from a ...
0
votes
1answer
103 views

Enemy clones don't target player

In a small game that I'm making enemies multiply when you kill them, however when clones are instantiated they don't chase the player like the original prefabs do (example: ...
1
vote
0answers
52 views

A problem with collision when a sprite changes size (Phaser framework)

I have a sprite in my game that changes size at certain points in the game. It changes size via the sprite.body.setSize method. Unfortunately, it seems that the sprite is unaffected by objects that it ...
1
vote
1answer
103 views

Prefab disables its script when a clone is instantiated

A clone of a cube is spawned when it is destroyed, however the clones disable the script in the editor (example: http://gfycat.com/SnarlingScornfulEgg). Used the exact same script for a different kind ...
2
votes
1answer
75 views

How do I change the material of an object with Script in Unity?

I was making a game with Unity and I want to change an object's material using JavaScript when the player collects 5 collectables that I made. The collectables get stored in an int variable called ...
2
votes
1answer
58 views

How do I save variables and load them in Unity with JavaScript?

I made a game and i want to save the high score and load it back. I need to save 3 variables and load them when the game starts. How do i do it?
19
votes
3answers
3k views

How do I make a JS game downloadable?

I can put the HTML and JavaScript together in the same .html file, but the images need to be separate files. The only solution that comes to my mind is to give to the user a .zip folder. This is not ...
1
vote
1answer
83 views

How do I use elapsed time as the player's score in Unity?

I'm making a "survival" game, where the goal is to stay on a rotating board as long as possible. I want to add a score system based on how many seconds passed. For example, if you stay on the board ...
1
vote
0answers
83 views

Extracting Top-Down Race Track From Google Maps

My final year project for university is based on the idea that a two-dimensional top-down multiplayer racing game can be made using Google Maps to dynamically generate race tracks. The idea is that ...
0
votes
3answers
90 views

How to move around in a map and remember position?

I am working on sound labyrinth game. My game is about a person getting trapped in the basement and the only way to navigate and get out is through sound. I have created a map over the basement and ...
1
vote
0answers
20 views

p2.js physics engine behavior on Heightfield

I am writing a small game consisting of a 'ragdoll' character riding a skateboard. I have created a 'skateboard park' with some ramps and a jump. I am using a 'heightfield' object as the ground. ...
0
votes
1answer
100 views

Map scrolling around the world

I am developing an TBS (turn based strategy) game. I have created a simple canvas renderer to render hexagonial map. I already implemented scrolling on the map. My current problem is that I want to ...
1
vote
3answers
156 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
0answers
17 views

Crafty Bind “createView” to viewport - TiledMapBuilder

Is there any way to bind the createView function to the player entity? For Example: I am moving forward and the map is automatically loaded. I call the Map with: Crafty.e("2D, DOM, ...
0
votes
1answer
36 views

changing a sprite width when playing a reel using Crafty.js

can anyone help me with this : http://jsfiddle.net/B5UsC/20/ you can see that the sprite animation is not rendering correctly when the reel is in the last frame when animating Hardpunch is it ...
0
votes
1answer
58 views

Move camera from wherever camera is to pinned point

So, I need to switch/ move/ animate camera from point X (not point A,as I don't know where the camera is at that momemnt) to point B (place where you want your camera to move). This is for ...
0
votes
0answers
17 views

changing sprite coordinate when defining a new reel in crafty.js

this is my jsfiddle : http://jsfiddle.net/B5UsC/18/ this.bind('KeyDown', function () { if (this.isDown('A')) { this.__coord[0] = 57; ...
0
votes
1answer
30 views

confusion in animating a sprite sheet using craftyjs

can anyone help me with this : http://jsfiddle.net/B5UsC/15/ you can see that the sprite animation is not rendering correctly and i am guessing that i am not using the exact width of the sprite ,i ...
0
votes
1answer
73 views

I can load new tiles but how do I load new chunks?

I have successfully been able to add new tiles and place random trees on a 2d map grid however I haven't used chunks. I just load a new tile when the player moves and save it to the map array. But I ...
1
vote
1answer
74 views

Objects don't instantiate at mouse position

I'm trying to get the player to shoot a projectile at the mouse position, however the projectile is shot in weird directions (http://gfycat.com/BothFluidHoneyeater). Here is relevant part of my ...
1
vote
1answer
88 views

how to store game state for a multiplayer board game eg. poker

First Approach: Store the state in database and play with database queries. Could a database handle the load, as poker is quite fast paced, and I have to query/update database for each player move. ...
3
votes
1answer
60 views

CSS Sprite position updates slow due to addition of 'px'?

I'm moving fewer than 10 position: absolute elements around the screen. An enormous amount of CPU time (profiled in Chrome as (program) i.e. native code) is used where I do the following: style.left ...