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
3
votes
1answer
148 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
38 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
0answers
47 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
19 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
41 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
53 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 (...
-1
votes
0answers
44 views

How can I make two joystick in my game?

I'm trying to make two joysticks in my game something like this: I used a ready code to make one joystick in my game. it works correctly but I don't know how can I add another joystick.
0
votes
1answer
58 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
48 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
36 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
46 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
32 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
47 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
33 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
49 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
12 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
66 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
12 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
80 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
20 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
25 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
36 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
10 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
15 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
23 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
122 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
15 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
86 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
39 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
57 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
103 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
40 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
61 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
54 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
54 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
36 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
17 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
56 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
45 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 ...
0
votes
0answers
79 views

Moving player one tile at a time (Javascript)

I've been watching this tutorial and found the code works flawlessly. Although, there is something he doesn't cover in the video. How to move the player one tile at a time. Every tutorial I've found (...
0
votes
0answers
42 views

Cant get my tabs to hide in my game

So I have tried alot https://codepen.io/tmanrocks999/project/editor/DKNEEv heres the gist of it. i want on launch for the game to only have the home tab available. after 1 rebirth hometab and ...
0
votes
1answer
51 views

makeing a quest system in a html clicker. need help making repeatable quests and quests being done

So i have a pretty good clicker quest system in place( click/ use spells/collect stuff etc) but im having a hard to making it a reward system. The reward should only go off once then the quest should ...
1
vote
1answer
49 views

Using a setTimeout to Jump

I am trying to make a jump function. I am making a game in html5 canvas with Javascript. I have gotten the player to move. When making the jump function I decided to use a timeout to reverse the ...
0
votes
0answers
35 views

Using a JS Query to work as an HTML Anticheat?

So, I have a project, its a "cookie clicker" by definition, and I wish to work out how I can protect the game from users being able to edit ...
1
vote
1answer
43 views

Problem with making camera follow player in Javascript

So I'm testing a few things in Javascript and something I was testing was making the camera follow the player. When I move the player, instead of the dots going away from the player, they follow the ...
0
votes
1answer
58 views

Hideing tabs in a clicker game

So i think i have a good system for this but its only working on the first tab. its really confusing me i tried a bit of ways to fix this. https://jsfiddle.net/h3fo7rL9/10/ scuffed fiddle with my css ...
1
vote
1answer
20 views

Changing JavaScript Player Object based on keypress

I'm currently working on a basic JavaScript top-down shooter and I've run into a dilemma. I'm trying to implement a basic toggle weapon system however when I press the key it changes the weapon ...