Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

1
vote
0answers
17 views

Get return of asynchronous callback since module export- Nodejs

Server: require('./MovimientoJugador')(); var camino4=MoverJugador(startX,startY,endX,endY,mapa2); console.log("Camino: " + camino4); MovimientoJugador: ...
0
votes
0answers
18 views

Make players Rigibody move in direction its going?

I have my snowboard character which I am trying to fix the movement for. At the moment, The player is using transform.forward on the rigidbody to move forward. If my player turns around and faces up ...
0
votes
1answer
18 views

How to handle a scrollable map and player coordinates

I have a large map that a player will navigate over. Currently, it is just a single background image, but I would like to make it tiled map. How do I properly keep track of player coordinates? ...
0
votes
0answers
35 views

Using dom elements for game interaction - slow performance

I have a need for my html5 game (using melonjs) to allow users to click tile areas on the map. The idea is it will show a css styled hover area. The browser tested is chrome. I could do this natively ...
1
vote
2answers
56 views

How to get the Javascript equivalent of GameMaker's `hspeed` and `vspeed` given only `direction` and `speed`?

I'm using a NodeJS server to control NPC movement in a multiplayer game, and when they get too close to the edge of the room I need to reverse either the horizontal or vertical components of their ...
0
votes
1answer
19 views

How to rotate player to face mouse on canvas?

I'm building a basic game using plain javascript and I am trying to rotate my object to follow my mouse. I've tried getting the client's mouse X and Y then subtracting the canvas width and height ...
1
vote
0answers
10 views

Camera Sensitivity in PointerLockControls to match actual games

I am creating a FPS game online. I want the user to be able to use a sensitivity they are familiar with from games they've played. In this case, I want them to use their Fortnite sensitivity. I am ...
1
vote
0answers
36 views

How can I get my player's character to slide along a rail?

I am creating a snowboarding game and would like my player to be able to jump on a rail and move along it if it lands on it. I have no idea how to approach this. I have already tried using ray casts ...
-3
votes
0answers
41 views

Desperate need of help simpler version of pong [closed]

im doing a school project which involces creating a reeeally basic Pong game in javascript. and i dont have the knowledge to do it. im in way over my head so im asking humbly if anyone out there could ...
1
vote
1answer
101 views

Is this a reasonable method of detecting JS memory hacks?

I'm working on a single-player browser-based RPG in my free time. I do allow for saving the user's game on the server, but the game is largely going to run locally and I therefore acknowledge that it ...
0
votes
0answers
33 views

Stuck at Goomba's speed and cancelling animation at game over

I'll try to be as precise as possible. First Issue: If you look in the code, I have a drawObjects function which calls collisionDetection function. Inside collisionDetection if player(mario) touches ...
1
vote
1answer
67 views

Click on an isometric plane and obtain normal coordinates

I have photos distributed as cells. When I click, I get the corresponding row and column. console.log("Col:" + X + "Row:" + Y); When applying an isometric view conversion like this: ctx.translate(0, ...
0
votes
1answer
29 views

Detecting collision between 2 rotated rectangles with limited parameters

Are there any function that can detect collisions between 2 rotated rectangles in javascript with this kind of information: ...
-1
votes
1answer
27 views

Converting Javascript to C# [closed]

I am trying to convert the following JavaScript code: ...
0
votes
0answers
21 views

Storing entities in a multiplayer socket.io/node.js game

Let's say the server stores each particle as its constituent information (i.e. a JSON of attributes like 'position') and the client stores each particle as a sprite for rendering. How should the ...
0
votes
0answers
49 views

Handling multiple resolution

I have been trying to handle different mobile phones resolutions for my game. But the scene is not fitting accordingly in some screen its perfect but in some other screens it is shrinking. My question ...
0
votes
2answers
43 views

Javascript Jumping Physics

I have asked questions for this project before, but the jumping physics are a bit messed up. I cannot jump unless I hold down the W key, and then it just teleports me upwards. Does anybody know how to ...
1
vote
0answers
50 views

Junk movement with steady 60fps on Web canvas

I'm new to building games on canvas, and I'm trying to create one. But I encountered a problem with sprite movements. My sprites move is smooth, but sometimes it starts to "jump". FPS is stable 60 ...
1
vote
1answer
35 views

How can I convert screen coordinates from a click to 2D scaled world coordinates?

I need a way to convert screen coordinates obtained from mouse clicks to world coordinates in my 2D game. To create a zoom effect controlled by the user, before drawing a model I will scale all of it'...
0
votes
0answers
34 views

How to apply toastr notifications when user get leveled up? [duplicate]

This question is about when user get leveled up the toastr will pop up. What I want to do is i want to put the toastr.js inside my script but I don't have idea how to implement. ** Link and Script **...
1
vote
1answer
33 views

How can I draw lines and curves on a canvas that's not rendered?

I need to draw lines and curves on a canvas that is not rendered on the screen but just updates the array of pixels that would otherwise be rendered. I need this to separate my game engine from my ...
2
votes
1answer
53 views

Issues with AABB on a platformer game

i'm facing an issue at the moment in my javascript/html platformer game that despite searching for this issue i can't solve. The problem is this: When i place two platforms next to each other and the ...
0
votes
2answers
55 views

Player fly's off of canvas when key pressed

I am fairly new to game development. I am programming a basic JavaScript canvas game. Whenever I press a key my player goes flying off of the canvas. Here is the controller code ...
0
votes
0answers
30 views

Full energy transfer between two identical objects

I'm trying to simulate a game like billiards / shuffleboard / curling where two objects collide and under a perfect direct hit all energy is transferred to the second object. Both ...
0
votes
0answers
31 views

How to control text font-size and plane width on a plane object with A-frame

I'm trying to create a VR game using A-frame. The problem is that the font-size of the mouseMenu: ...
0
votes
2answers
40 views

How to calculate turret position after rotation

I'm trying to make a tank character for my game but I couldn't do the math of firing bullets from turret instead of center of the tank. I tried some Stack Overflow solutions but I couldn't understand ...
1
vote
1answer
41 views

Why is my client's body drifting even after using data from the server, and how do I fix it?

I am trying to use Box2d on nodejs server with libGDX client. What I am trying to apply is authoritative server model so clients are just sending input data to server, server is running simulation and ...
0
votes
0answers
19 views

Box2D LibGDX Cant Create ChainShape Static Body in server side with same position client side

I am trying to create walls in server side which i have already created in client side.This is how i create them in client side: ...
1
vote
0answers
59 views

Is there any API that returns information about “all games”? [closed]

I'm building a project about games and I need to make a "portfolio" of games. Something like a catalog of Netflix, but about games, and I need some basic information about the game, like Publisher, ...
0
votes
1answer
34 views

Can a .exe file ported from a program like NW.js or Electron be put console stores?

I'm early in development working on a game in HTML5/JavaScript canvas, and I wondering if porting the game with some HTML/JS to .EXE converter would allowed it to be posted on consoles? I think it ...
0
votes
1answer
52 views

Make a variable go down as another goes up?

I am making a JavaScript game called "Spoop: The Clicker", and I have a variable shown by text: ...
0
votes
0answers
10 views

MelonJS - How can I change position of collided object (push or pull with player Entity)?

I'm getting started on game development with MelonJS and I don't get how can make a Pushable/Pullable Entity. I'm pretty sure that the approach I'm taking is not right since It cannot detect the ...
1
vote
1answer
77 views

How do I make sure everyone sees the same distance across different resolutions?

Hello game dev community. I have recently got into making games in a browser window, and me and a friend ran into a common problem. Let's say I have a game like diep.io, where users can control their ...
0
votes
0answers
18 views

How can I make a game-wide round timer with socket.io?

I'm making a javascript multiplayer networked game called "Ultimate Tag". It's basically a multiplayer tag with upgrade every time you tag someone. I want to have 5 minute rounds with timers, and a ...
0
votes
0answers
73 views

Return value from function in unity webgl and javascript communcation

I am using Unity webgl for my project and want to communicate from browser JavaScript to C#. One way is to call C# function from JavaScript using SendMessage. I am easily making call using this code ...
0
votes
2answers
43 views

How to limit speed while still adding external forces

I have a ship with a single thruster in space (no friction). My ship uses integration on every update, like this: (PSEUDO CODE) ...
0
votes
0answers
12 views

Find circles velocities after collision [duplicate]

In my program, I have multiple balls that are given a random velocity. I'd like to have it so after they collide, they "bounce" off each other. The balls have a mass, radius, position (Vector), and ...
0
votes
1answer
58 views

Controlling a thrustered 2D space ship with angular rotation and max speed

In my game I have a computer controlled ship that is accelerated by a thruster: with a constant force and in the direction of the ship's current orientation/rotation angle. Thrusting My ship has a ...
0
votes
0answers
22 views

How to make physics of motion on an inclined surface

There is the following platform: And a coin above it: And the following code using arcade physics: ...
2
votes
0answers
121 views

Phaser: InvalidStateError

I am using the Phaser framework for game development, but while working on it I face a bug which is annoying, I have the following message: InvalidStateError: An attempt was made to use an object ...
0
votes
1answer
50 views

Phaser: How to call a function inside another function?

So I actually have the following code that works: ...
0
votes
0answers
13 views

Phaser: How to use a simple timer from 0 to 3

I am using the following code (which is a simplified snippet in order to make it more readable): ...
0
votes
1answer
66 views

How do I move an object in a square pattern?

I have some bots that can move via setting the x and y. I have already been able to make them move in a circle pattern, but how do I make them rotate around the player in a square pattern? I'm not ...
0
votes
0answers
27 views

When the motion button is pressed, the shape of the character changes and always goes to the left direction

good day. When the motion button is pressed, the shape of the character changes and always goes to the left direction. Why is this happening and what is the solution? Pressing two buttons moves to ...
0
votes
1answer
405 views

“RENDER WARNING: there is no texture bound to the unit 0” When not Rendering Texture

I have a webgl program that sometimes renders textures, but mostly renders triangles or lines. When I am not rendering a texture, webgl gives the warning, "...
0
votes
0answers
11 views

Crossword puzzle [duplicate]

How do you make the keyboard arrow keys interactive so that when the user presses one of these it will move the cursor in that direction; I am working in html. Thanks Angela Jackson
0
votes
0answers
288 views

Collision detection not working in Phaser 3

I am new to phaser. So I started working on a game but I am stuck at implementing collision detection. I want to do it between a static group(dot) and a Sprite(obs). function create(){ ...
0
votes
1answer
45 views

Why are not the images loaded in Phaser?

I am starting to use phaser to create games and I found a problem that I can not find for more tests that I did. I can not show the images I am uploading. You only see a small square in the center, (I ...
0
votes
1answer
39 views

Why does my value increase a ton when the tab switches from inactive to active?

I basically have a lerp function similar to this one: Client interpolation for 100% serverside game when a new server update is received, the update frequency is added to a variable (msAhead) and the ...
1
vote
1answer
59 views

I keep coming across an error “Cannot read property 'innerHTML' of undefined”

I'm new to game designing and have to create a game for my project but I keep coming across an error to do with: index.html:93 Uncaught TypeError: Cannot read property 'innerHTML' of undefined ...