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
13 views

How do i Shoot a Projectile towards the Cursor? [duplicate]

I'm making a game and just wanted to know the easiest way to setup spawning projectiles that head in the direction of the cursor relative to the player.
-2
votes
0answers
21 views

Does anyone have a suggestion for a game I should code in js? [closed]

This isn't a directly code-related question, but I'm wondering what game I should code in javascript. Thanks!
0
votes
0answers
23 views

2D engine design/architecture: transformations

Hello! I'm working on this hobby little 2D engine in JavaScript because I want to learn how all this things are implemented and architectured in general. Internet is full of resources but most things ...
0
votes
0answers
10 views

conversion between world space and screen space

I am making a multiplayer game with gravity mechanics and planetary motion. I started by hard coding coordinates according to canvas size but now i am realizing that for different resolution planet ...
0
votes
0answers
10 views

Planck (rewritten of Box 2D) - Two sensor collide

I want to print "on" when two sensors collide. This code is printing "on" in any fixture collide. I just want for 2 sensors. ...
0
votes
0answers
20 views

How to make a minimap in javascript (p5.js)

So i have a game and i want to add a minimap on the bottom right corner. I have seen how to do it with html javascript, which has the ode written in index.html, but i want to write the code in a .js ...
0
votes
0answers
7 views

Planck.js (rewritten of Box2D.js) - 8 direction box movement

I have a box in Planck.js. I want to move this box with some keys. How can I do that? My code: ...
0
votes
0answers
22 views

is there any way to disable the obnoxious native iOS safari scroll to url bar and notifications behavior?

I have a feeling what I am about to will not be possible, because well... Apple. I am making a full-screen web based game, and I have a 8-directional virtual joystick on screen (a circle divided into ...
0
votes
1answer
58 views

How can I fix sprite vibrating randomly which is moving towards the mouse while using camera.position set to the sprite as the center?

So, when I use camera.position.x = player.x; camera.position.y = player.y; to set the center of camera to my sprite, the code doesn't work as intended to. It's ...
0
votes
0answers
16 views

Launch event at the end of an animation with phaser 3

I'm starting to develop in Phaser 3, and I'm really a begginer. I'm trying to make an attack move of an archer sprite, but I cannot make it work right... This is how I have defined the things ...
0
votes
0answers
28 views

Make 2d camera rotate around the player

I'm making a simple 2d javascript engine based on a scene graph (all game objects are containers whose children live inside their parent's coordinate space). My camera implementation works by setting ...
0
votes
0answers
23 views

Platformer collision detection problem - player snapping onto sides [duplicate]

I am having problems with collision detection. I am trying to make a simple platformer but when the player is falling or moving too fast it sometimes detects the wrong collision side. I am getting the ...
0
votes
1answer
93 views

How to get the address of a nearby square on a chess board?

I'm making a chess game from scratch and I got stuck. So far I have all my figures placed, I have the positions set, I've already done the collision detection and everything. When I click the figure ...
2
votes
0answers
17 views

Javascript: Eventlistener 'keydown' not registering all keys pressed when holding down other keys [duplicate]

Sollution provided in the comments. The issue is that my keyboard has what is called ghosting issues, this means it doesn't support some key combinations when pressed together. When the user holds 's'...
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
37 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
52 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
113 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
94 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
23 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
55 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
19 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
193 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
53 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
136 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
35 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
55 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
60 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
201 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
86 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
47 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
56 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
59 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
61 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
36 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
237 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
15 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
111 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
20 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
51 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
87 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
54 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
43 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
27 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
25 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
2 3 4 5
26