"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
0answers
10 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
73 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
19 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
42 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 ...
0
votes
1answer
53 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
votes
1answer
61 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 ...
0
votes
1answer
58 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 ...
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
42 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
44 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 ...
0
votes
1answer
40 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
155 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. ...
-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 = []; ...
2
votes
3answers
116 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 = ...
0
votes
1answer
50 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
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
84 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
1answer
48 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
70 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
85 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
44 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
27 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 ...
3
votes
0answers
42 views

Image won't scale after click

Despite being a long-time developer I've never played with JavaScript libraries or any sort of graphics development. With my son we're trying to create something interesting and are using ...
0
votes
1answer
88 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 ...
0
votes
1answer
52 views

javascript efficient collision detection [closed]

I have a processing game where I am having serious lag problems with collision detection. I am using the most effective code I can think of however after about 9 levels in The game gets unbearably ...
1
vote
1answer
69 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
1answer
44 views

My polygons only register a collision if they are the same shape and directly over top of each other

I'm trying to learn about 2d polygon collision detection/handling and have ran into a snag. After running through lots of tutorials and sample code I've attempted to implement my own polygon class ...
4
votes
1answer
116 views

Fixed Time Step Flutter

I've seen a lot of questions about this problem, but really no solution. Hopefully I can explain the issue well enough that I can get some sort of closure on this problem. I'm using a Fixed Time ...
1
vote
1answer
226 views

How Can I Find a Shape on 2D Array?

For the code in my test project, I want to find 2D[,] array shape on the char[][] list. I created an actual map with 'char[][]' array. So, how can I find a tileChar's shape on the worldChar array? ...
1
vote
1answer
108 views

Making a Fall Trigger Game Over

I have been struggling with this fairly basic issue: To make a game over menu appear upon death. I am making a 3D game in Unity, where you, the player, must control a sphere with the basic controls: ...
1
vote
1answer
79 views

3D Planetary gravity

so i am making a thing in javascript and i want to have planetary gravity in my "universe". But when i use an equation to calculate the acceleration by gravity i get one number. That is how fast the ...
0
votes
0answers
79 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
0answers
40 views

Strategies to make it difficult to cheat + easier to identify cheaters in Javascript/HTML5 game [duplicate]

I intend to have a Javascript/HTML5 game with a global leaderboard. I have devised a very simple system for submitting highscores as follow: When the game finishes, the game client makes a POST ...
0
votes
1answer
581 views

How do I hide UI canvas in c# Unity3d?

I want to display the final results at last in the game when gameobjects finish the winning(finish) line. For that I am using canvas and in that a panel onto which an image is attached. I have to hide ...
0
votes
0answers
32 views

Circle velocities stay the same after elastic 2D collision

I am following this paper in trying to create elastic 2D collisions among two circles. The problem is that my end velocities are the same as my start velocities. I've looked over my code and don't see ...
-2
votes
1answer
44 views

Understanding Javascript Variable Initialization [closed]

I saw this piece of code while doing research for an idle game I am making: var minions = new Object; minions = { 0: { name: "Mole", description: "...", price: 10, ...
4
votes
7answers
830 views

How to avoid cost comparison each and every frame?

I'm toying around with a ticker(incremental game) for JavaScript. The basic idea is that you have buttons that represent buildings, each building provides a certain amount of resource per 'tick'. ...
0
votes
1answer
127 views

Unity 5 Animation attaching

I have created the walking and idle animation for my fps player. I've added a JavaScript script to access it, but when I run it and press button(w), it stops and says that the animation is not ...
1
vote
0answers
31 views

align local Y to be parallel with global Y during or after slerp

I am using the following function to have a globe rotate a point on its surface to face the global Z toward the camera. This works fine, but after each rotation the Y axis seen as a green line is not ...
18
votes
5answers
3k views

Prevent cheating in html Javascript game [duplicate]

I have made a Javascript/html game. Now the problem I have is anyone can edit the client code and cheat in game for example there is a man shooting a enemy. Man HP: ...
0
votes
2answers
158 views

How do I keep a PHP server running forever?

I'm making a web game RTS, it's mostly create units, manage resources, attack with army, and level up factories. I have created the basics of the game using Javascript, PHP, and MySQL databases. I use ...
0
votes
0answers
67 views

How to get the angle an object is travelling at

I'm trying to figure out how to get the angle an object is moving at, but have ran into a few problems. My player object is moved by rotating the entity left and right by using the left and right ...
0
votes
2answers
89 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 ...
1
vote
0answers
71 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 ...
0
votes
0answers
40 views

How to get the absolute position of the sprite in the renderview regardless of the pos of PIXI.Container?

I implementing panning on an infinite platforming game I developing but this is messing up with my current setup and structure of the game world (collisions, player location, etc.). Though I figured ...
1
vote
2answers
107 views

How do I use delta-times to determine the speed of a frame-by-frame animation?

I have a character spritesheet with 8 images. How do I animate it? At the moment, the sprite changes to a different image every frame, which makes the animation speed vary with framerate. I have a ...
0
votes
2answers
142 views

How can i fix “get_transform can only be called from the main thread” error in my code?

Here's my code: var forward = transform.TransformDirection(Vector3.forward); var input = Input.GetAxis("Vertical"); function Update(){ transform.position += forward * input * Time.deltaTime; ...
3
votes
1answer
63 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() { ...
2
votes
1answer
60 views

Particles to Denote Movement in Space

I'm currently working on a WebGL project to realise an idea I've had for some years. On my desk is book on making a space sim written 15 years ago. There I found some algorithm for particles in ...