Questions tagged [javascript]

"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/JavaScript

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

Any way to set drag events on a phaser 3 group?

I'm trying to set a drag event on a phaser 3 group, but I wasn't able to achieve what I want. I was reading some phaser 2 blogs, and they said that it isn't possible to set a group a drag event. Can ...
0
votes
1answer
28 views

setTint() on half image

I'm developing a game where I need to paint half of a image when the user is either wrong or right. To paint the image, I'm using setTint() to paint the image the ...
2
votes
2answers
40 views

Same noise generator for C# and Javascript

I'm writing a 2D web racing game with procedural generated maps using perlin noise(as a university project). The server is written using C# and the client using Javascript. I've developed procedural ...
0
votes
1answer
69 views

How to get the overlap volume of OBB and or ABB?

The following code is a current attempt at a function I have to determine if two bounding boxes overlap. The bounding box structures are [min[x,y,z], max[x,y,z]] ...
0
votes
1answer
49 views

Blend different biomes using linear interpolation

I've been scouring the internet for hours looking for a solution to blending biomes that have different amplitudes and frequencies together to create a seamless world. A recurring theme I'm seeing is ...
0
votes
0answers
21 views

Libnoise bounding box - from spherical to planar

I'm trying to convert a bounding box inside a spherical map (equirectangular image as a result of Libnoise/c++) into a planar projection, but I can't find the correct algorithm for it and I'm not good ...
0
votes
0answers
53 views

How to open box item animation?

I want make 2d open box animation. Like cs-go open keys or other random box. I need the basics of implementation it and i want get more information about it. Thanks. Upd: Steps. I have array of ...
0
votes
0answers
13 views

Map an equirectangular square slice inside cubemap

I'm trying to map a square slice of an equirectangular image inside a cubemap with 6 faces, without distortion. The point is that I'm dealing with huge array sizes if I try to project the whole ...
0
votes
0answers
36 views

Catch blocks while dodging other elements game

I'm working on this game where the user gets points for catching the right falling colour block. If the user catches the wrong colour block they will loose the game. For ex: I assign the user to ...
3
votes
1answer
179 views

Representation of trains on a simplified rail grid

I'm working on a hobby game, basically about train dispatcher's job. (stack: Typescript, phaser.js) My map is based on a grid, each tile can hold 1 rail tile (well, except junctions, but we can ...
0
votes
0answers
49 views

Convert Flat World Angle into Isometric Angle?

My game is isometric 30 degrees (think Diablo 2), I'm looking to convert the angle A1 from the player tile A to the destination tile B into the appropriate angle A2 in the isometric view. For the ...
0
votes
2answers
133 views

How to use local-storage

So I have this game and I would like to have a save function. Here is my code below: ...
0
votes
1answer
30 views

I'm trying to work with setInterval inside a loop and it doesn't work the i want it to

I am making a 2d canvas game in Javascript. I am trying to make the enemies that are coming to my hero to shoot a bullet every 3 seconds. ...
0
votes
1answer
51 views

Making an enemy shoot every few seconds

so I am making a 2d canvas game in Javascript and I want the enemy mobs to shoot a bullet every let's say 3 seconds. I'm almost done with the code , i made everything i just don't know how to make the ...
0
votes
1answer
57 views

How do I change the level of my game by changing the file loaded?

I am making this 2d canvas game in JavaScript and I want to switch to file level2/level2.html when the boss of level 1 (...
0
votes
1answer
198 views

Making a 2d shooting game. need a working shoot function

I tried to follow some guides but couldn't get their functions to work in my program. What i tried is commented out in my code(the for loop). I want a working function on space press create a bullet ...
0
votes
1answer
66 views

How to add a collision function to a game

Ive tried a few things but i cant get a working function if player collides with object set speed to 0( stop moving) ive tried to use the function under "game over " and change the things to make ...
1
vote
0answers
42 views

RayCasting with Mode7

I'm trying to join the mode7 algorithm with RayCasting. For mode7, I'm using a simple rotation matrix to implement the rotation. The result is a little strange and I can't fix it. Do you know what is ...
0
votes
0answers
54 views

How to create a character for a maze game

I was messing around with some maze stuff. I was wondering if its possible to add a character to what i have even though Im not using canvas.How do you position an html element representing your ...
1
vote
0answers
44 views

How can I use canon.js in three.js editor?

I would like to add bullet physics to a scene crated by the three.js editor. Where do I need to put the canon.js file in order to be able to access it's functions from the editor scripts? I ...
0
votes
0answers
20 views

Calculate direction of object to intercept moving object between two points [duplicate]

Please have a look at this graphic: I need to calculate the direction of B in order to intercept Z between A1 and A2, if possible. Both, Z and B start at the same time. Can anyone help me with the ...
0
votes
1answer
49 views

How to generate a random tunnel consists of series of two line paths

I have a 2D path that follows series of lines thru points p1 p2 p3 p4. Like this: ___/\__/\___ I want to make a tunnel out of this path, so I need to split this ...
0
votes
0answers
34 views

How to update and render an 2D endless runner that goes bothways

I want to make an 2D endless runner, that also allows player to go backwards. So I have to create random world as the map goes, also keep the old map in case player goes back. I ask about how to ...
-1
votes
1answer
139 views

threejs lerp and camera the animation is not smooth

what is the problem with linear interpolation? in update() in case this is animate() and when I call zoomCamera() in update() there is lerp with smooth but when I call here ...
0
votes
0answers
13 views

Unity move sprite based on array coordinates

I am converting a Cocos2d game to Unity. I have sprite chalk stick that writes on a board in 28 different scenes. I use an array of coordinates for of the scenes. I this possible with Unity? I have ...
0
votes
0answers
89 views

How to support JS/Python scripting a C++ game engine?

I'm currently writing an Entity/Component/System architecture game engine in C++, and I have the beginnings of a lua scripting system in place, which seems to be quite popular, but I feel Javascript ...
1
vote
0answers
13 views

Unity Help solving Uncaught Abort on HTML5 Build

For some reason there is a Invoke that is triggered when a button is clicked that causes my game to crash. Any idea how I can sort this out? I have plenty other Invokes and none has given problems. I ...
0
votes
0answers
49 views

Non tile based bouncy platformer with sloppy lines and everything

I want to make a bouncy platformer as in this https://www.youtube.com/watch?v=WMrmGUdWprA. This game is not tile based, but there are sloppy lines going in any direction. I see two challenges: How ...
-1
votes
1answer
16 views

Calling data from a java script object with a variable and dot format

I have a const object, player, and inside that, I have several things one of which is playerResources. ...
3
votes
0answers
85 views

Game runs at different speeds in Chrome versus Firefox

I am using Box2D for physics on the server side. Player position is updated on the server, so there is nothing the client can do except give input. But running game in Chrome only, the player moves ...
0
votes
2answers
31 views

Determine when a PIXI texture is loaded to clone it

I'm in the latest PIXI v5, where my texture is made like let texture = PIXI.Texture.from(TEXTURE_URL). The texture isn't loaded synchronously- Pixi just covers ...
0
votes
0answers
26 views

Account for scale offset?

I have an odd situation where I know the position of an item on a mouse click and I know the panning state of a 2D camera pointing at it. So what I do is render an object at the point in which the ...
0
votes
1answer
37 views

how to calculate resulting velocity and angular velocity rocket has on center of mass

The issue i am having is that i can't seem to figure out how to apply force from a rocket to a bodies center of mass. *Edit This is in 2D e.g. Let's call the body 'ship' the 'ship' is 1000 (...
0
votes
0answers
17 views

Using three.js, how can I set up a headless version of a game state on a node server like the babylon.js-NullEngine?

I have been working towards creating a multiplayer three.js fps game and am planning to only do client-side prediction in the browser. On the other hand, I am using Node.js, Express.js and Socket.io ...
0
votes
0answers
17 views

How to go to the next level when a model hits a certain spot

I'm trying to make the ball go to the next level automatically, without pressing a button.
0
votes
1answer
24 views

Fixed vs Fixed Collision on ImpactJS

I'm trying to implement a collision on ImpactJS entities that both will be stopped when collided and being pushed. This will be exactly similar to player to player collision on top down games such as ...
1
vote
2answers
123 views

How can I adjust the speed my character jumps at?

I've applied this method How to make a character jump?, like: ...
0
votes
0answers
33 views

How do I scale a group in Phaser 3

In Phaser 2 we scale a simple by setting the scale property as explained in docs: https://phaser.io/examples/v2/groups/group-scale But there is no equivalent in Phaser v3. The possible url https:...
0
votes
1answer
103 views

How to encode a save game / game state as a string?

I'm building an HTML game. For this game I want to implement a save-feature that should work like in some already existing games: The user can chose export, this ...
1
vote
1answer
41 views

Same scroll speed across devices with different DPI

I am creating a simple game in JS, something like the flappy bird :) For pipe scroll, I am using a linear tween. I noticed that the speed of the pipes are different across different smartphone ...
0
votes
1answer
64 views

2d Tiled Map with images in Javascript

I'm trying to create a tile map with simple 2d images (30x30). I restarted the project from my previous post, and instead of using someone else's code, i though I would learn more to start from ...
1
vote
2answers
122 views

How to create a map array with multiple layers?

I’m trying to create a map array without using JSON because I want to dynamically generate the map: ...
1
vote
0answers
41 views

Problem with collisions detection on canvas platformer

Having a lot of trouble with my collision detection in my platformer. If you go straight to the right the block will float. Also the corners let the block sink right through and the walls are sticky. ...
0
votes
2answers
63 views

How can I delete an object when it's not stored in an array?

I have a boss appearing in my game, but since it's only one character I didn't put it in an array. Now I'm trying to make disappear if its health is less or equal to 0 but I don't know how to do that. ...
-1
votes
2answers
56 views

I need help with calculating the angle my character is aiming at

So im doing this program where i want my hero to shoot to the direction its facing , but for this job to get done i need to calculate the angle my hero is facing with Math.atan2() , atleasts thats ...
1
vote
1answer
56 views

Collision detection between two arrays with nested loops: why do I get a crash?

I'm creating a game where waves of enemies are coming to me and I have to kill them. So far, I'm doing great: it took me hours to come up with this nested loop to check for collision detection and ...
0
votes
0answers
43 views

Car physics: incorporating lateral forces for high-speed steering

I'm making a car simulation in Javascript and I am using this website to help me with the physics: http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html The ...
0
votes
0answers
20 views

Javascript or Animation in general tween, spring, mouse tracking, mixing

Back story. I am a web developer and i can pretty much do anything on the web. When i first started doing some programming it was in flash actionscript 3, and i was 14 and now i am 29 and still i ...
0
votes
1answer
62 views

frame rate drop in html5 game

i have Incorporated gravity mechanics and collision mechanics to my game. the game works fine for some period of time after that i am getting significant amount of frame rate drop.i am doing some ...
1
vote
1answer
47 views

2d array with empty elements

I am working on a game with a number of different grid components. Each grid would be about 15 squares wide by 15 squares tall. Each of the squares may either contain an item or not. Is there any way ...