Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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
0 answers
27 views

Line Of Sight in javascript DOM game

I am creating a 2D game in javascript using pure DOM, on my computer and on my cell phone WebGL or OpenGL do not work. How can I create Lights and shadows effects using Line Of Sight, for example, I ...
Haruki Hotarou's user avatar
1 vote
0 answers
31 views

Controlling Input Handling in Turn-Based Game

I've been building a turn-based style RPG in Typescript based upon this ROT-JS Tutorial. For the most part it's fairly clear and I have a handle on everything, except I've begun building out a ...
Joel's user avatar
  • 11
0 votes
0 answers
35 views

`textSubImage2D` inconsistent performance

I have a problem when creating a texture with WebGL. The thing that I do not understand is that the first call with texSubImage2D with a canvas leads to the ...
hoangphatmonter's user avatar
0 votes
1 answer
56 views

Object collision and vector reflection for complex polygons?

I am currently creating an environment to train aim-bot AI's for my game. It is a 2d world made of complex polygons, and the goal is to have the AI's shoot ricocheting bullets. Using a ray-casting ...
Beluker's user avatar
0 votes
0 answers
46 views

how do I continue my code so that the circle (player) doesn't go through the rectangle?

There is a collision, I find it on the side of the rectangle (I can’t do it otherwise), but I don’t know how to stop the circle, that is, so that I can’t go any further (and at the same time not get ...
kaliboba's user avatar
0 votes
0 answers
41 views

Should I be adding a database functionality for my game rooms?

I'm a little confused on when it's needed to bring in Mongo or MySQL in a web browser multiplayer card game. Here's my plan so far: I'm using React, Node.js, Express, and Socket.io. I'm having the ...
chung's user avatar
  • 101
0 votes
0 answers
20 views

How to use elapsed time to code a function to manipulate DOM

I'm a new software engineering student. I have a problem that I can't seem to get my head around. I am currently making a basic rhythm game like Guitar Hero using HTML, CSS, and JavaScript. I managed ...
8bitNostalgia's user avatar
1 vote
3 answers
191 views

Identifying extreme vertices for shadow effects in 2D game using JavaScript

I'm facing an issue while trying to identify the two most extreme vertices of an object in my 2D game using JavaScript. The goal is to determine where I should create a trapezoid to simulate the ...
Mark Vaaz's user avatar
0 votes
1 answer
146 views

Web application for efficient placement of blocks

Task: to develop a function that efficiently places rectangular blocks in rectangular 2D container. The location of the blocks in the container should be as dense as possible in order to rationally ...
Назар Саханда's user avatar
0 votes
0 answers
13 views

Help please I have task Web application for efficient placement of blocks [duplicate]

Task: to develop a function that efficiently places rectangular blocks in rectangular 2D container. The location of the blocks in the container should be as dense as possible in order to rationally ...
Назар Саханда's user avatar
0 votes
0 answers
66 views

How to draw a small circle 20px in webgl using JavaScript?

I could use triangles (make them using trigonometry). But the circle I want is small, only 20px diameter. I could also load a model but I need a quick solution. Is there an easy method to draw a small ...
Praveen Kumar's user avatar
0 votes
0 answers
38 views

Javascript global variable doesn't update

Here is the scenario, I have a GetImageAerial.jslib which has function something like this ...
Suriya Swami's user avatar
0 votes
0 answers
34 views

How can I apply blur filter in Phaser 2.7

can somebody please tell me how can I apply filters in general, and specifically blur filters in Phaser 2.7? The approach I found on ChatGPT is: ...
Haider Mansoor's user avatar
0 votes
1 answer
42 views

tubular mesh around any y=f(x). issue calculating normals

I used this to help create a 3d cylindrical mesh that wraps around any y = f(x). Each vertex is calculated by a point P: ...
Emre Tekmen's user avatar
0 votes
0 answers
66 views

Add a sprite, move with keys, Javascript example?

I have a small image (30x30 px) I want to use as a sprite on a Javascript screen to show students what Javascript can do. (They want to create games.) How do I link the image file to my Javascript ...
Jonathan Titus's user avatar
1 vote
1 answer
121 views

Padding in a vec3f array in WebGPU memory layout

I'm trying to write a WGSL structs parser (sort of webgpu-utils thing). In order to better understand the memory layout, I'm using wgsl offset computer as a helper. Having the next struct: ...
Michael Sazonov's user avatar
0 votes
0 answers
45 views

How to trigger a local file download for a screenshot from a Unity WebGL game?

Is it possible for a Unity WebGL app to trigger a local file download - binary data generated in the app, somehow triggering a browser download?
ina's user avatar
  • 294
21 votes
2 answers
7k views

What is a "normal" in game development

I'm new in Game development and probably this is a silly question. I had a look online but haven't found a clear answer, I did it bit quick but enough to evaluate that this is a confusing topic ...
Federico Baù's user avatar
-4 votes
1 answer
100 views

Why wont my code work

I have just started on a new short game and i am trying to figure out how to make a reward when i reach a certain value I expect that the counter starts at zero, and each time the button is clicked it ...
David Humphrey's user avatar
1 vote
1 answer
144 views

How do I react to a variable having reached a certain value?

I am a new coder and im trying to learn html. i have started working on a clicker game but im trying to figure out how to give a reward when my total clicks var has reached a certain value. the reward ...
David Humphrey's user avatar
0 votes
1 answer
83 views

Improve performance of server updating game state

I have a Node.js game that sends update packets to players every 30ms. The code I currently use works this way: Get the entities within each player's vision. Create a temporary object that stores ...
hmmmm's user avatar
  • 1
0 votes
0 answers
158 views

How to properly overlay HTML over canvas with scaling?

If I have <div container> <my html overlay> <my game canvas> </div> The canvas has ...
B''H Bi'ezras -- Boruch Hashem's user avatar
1 vote
0 answers
101 views

How to set pivot point for rotating a sprite?

Is there a way to set the pivot point for rotating a sprite? The default option seems to be arbitrarily chosen point on the sprite or the mid point. ...
Naveen's user avatar
  • 111
0 votes
1 answer
105 views

Camera movement with player

I'm developing a game using the html5 canvas, but I've never used it before and I'm having difficulty creating a camera. The intention is that it is the same as agar.io, where the player is centered ...
Jhon's user avatar
  • 1
0 votes
0 answers
45 views

How to implement 2D rigid body motion?

I'm already depending on two NPM packages for 2D collision and differential equations: sat rungeKutta I've a basic simulation structure, but don't know where to start with to use these two packages ...
Hydroper's user avatar
  • 101
0 votes
1 answer
63 views

Is it safe to store the state of a game in Javascripts localStorage?

I am going to be completely honest, this is not 100% about storing a game state in Javascript's localStorage, it is more to do with a utility program storing statistics. Since it can be related to ...
Rewind's user avatar
  • 113
0 votes
0 answers
21 views

Game character in the browser game appears on Android, but not on iOS

I have a problem with rendering the game on mobile platforms (the game is written on the Impact.js), the problem is only with the iOS actually, the screenshot below shows that the characters are ...
李白 puer's user avatar
0 votes
1 answer
158 views

Trying to calculate hitbox vertices for my game and adding SAT collision

I am currently working on a basic HTML, CSS, and JavaScript game as a freshman high school summer project. I am currently trying to implement separating axis theorem (I spent a lot of time learning ...
Yash-902's user avatar
1 vote
1 answer
168 views

Would it be possible to make a Game Genie like program in Javascript?

Game Genie was a tool for the NES that allowed users to input codes that were able to drastically able to change the mechanics of a game by getting CPU reads and replacing the game's response with its ...
Jake Miahn's user avatar
2 votes
1 answer
140 views

Where is the illusion of a moving camera perspective coming from in this rotatable cube model?

Just for fun, I had been attempting to build a model cube in vanilla JS that can be moved and/or rotated. What I was going for was the simplest possible representation (so, no adjusting for ...
Quack E. Duck's user avatar
0 votes
0 answers
52 views

Handle roads following in a javascript game

In a browser game made in HTML5/Javascript, I would like to handle the move of units in real-time. But units would have to follow some predefined roads... Canvas seems better than svg to handle ...
Charles Dexter Ward's user avatar
10 votes
2 answers
4k views

Wondering if there is a more efficient way to store level data in my game?

I am trying to remake Super Mario Bros. in JavaScript and I am trying to figure out if there is a more efficient way to create and store the level data. I have created 1-1 and here's what the code ...
Jake Miahn's user avatar
0 votes
0 answers
209 views

three.js shader to keep moving vertices of points cloud inside sphere

I am trying to achieve the effect of having a points cloud with moving points while also keeping them confined within a sphere of radius X. I have managed to do it without using shaders but I want to ...
Dimitris Karagiannis's user avatar
0 votes
0 answers
23 views

How is it possible to create a texture atlas from a list of images? [duplicate]

Given a list of images how is it possible to place them on a square image, so they take up the least amount of space?
Iter Ator's user avatar
  • 257
1 vote
1 answer
915 views

Do you need to know JavaScript to make games with RPG Maker?

Do I have to know how to code in JavaScript to make good games in RPG Maker MZ? I'm asking cause I know you don't really have to code in RPG Maker. I already tried some programming languages, so I ...
Inerzja's user avatar
  • 11
1 vote
0 answers
147 views

steering behaviors collision avoidance: vehicle shaking before arrive at destination

I have made a test sketch of collision avoidance using javascript, as you can see right here. I want the vehicle to move to the clicked location, avoiding obstacles on the way. It is working, but not ...
Ricardinho's user avatar
1 vote
1 answer
156 views

How to draw/calculate a parabolic arch to hit stationary target in Javascript

First off I must admit I'm really not good at math and am trying to learn but have had a hard time finding examples someone like myself can follow. I'm trying to figure out how to draw and calculate ...
cluelessgamedev's user avatar
0 votes
0 answers
99 views

How can i rotate an object based on the finger position?

I am using Lens Studio to build an AR effect and trying to use the position of the hand tracker fingertip to make a cube rotate. For example, as I move my finger on the x-axis the cube rotates in the ...
Harry's user avatar
  • 141
1 vote
2 answers
229 views

How to publish WebXR game on Quest or Steam stores?

I would like to develop a simple and small game for WebXR so that Quest, Index, etc. can play it. I would eventually like to be able to put it on the Quest store and Steam. Is there a way to publish a ...
Imperial A's user avatar
0 votes
1 answer
49 views

Adding requestAnimationFrame in isometric Tile grid Code is not working

Hi There this is my first Post on gamedev, and i hope everyone understand what i want :) First of all my Code is an very Personal Version from one Github Isometric Map. I Tryd now 2 Days to Add the ...
Tobias B.'s user avatar
1 vote
1 answer
60 views

How to instantly break method call?

I'm making 2d Mobile game using JavaScript. I have method that controls every character (Dumb AI) on battleground. It using recursion to call another action. I want to add debuff system and had little ...
Jakub Dobrzeniecki's user avatar
0 votes
1 answer
40 views

Why is this code keeping the listener which should be removed instead?

I am having some issues figuring out why this code still lets btn_1 call the function setstate3(). There is a function ...
subtlefly's user avatar
0 votes
1 answer
19 views

why does my button lose the changed cursor and mouseover behaviour as soon as I attach a class to my file?

Using adobe animate cc - exporting to HTML5 and coding in JS (or at least trying to) If I just hit cntrl+enter in adobe animate the button works as expected. If I run the app from a web server using ...
subtlefly's user avatar
0 votes
2 answers
810 views

How to create global function for all .JSLIB files?

I can't understand how to work with .jslib files. I don't understand the syntax of this type of file. Also I couldn't find any easy explanation of it The problem ...
EzioMercer's user avatar
0 votes
1 answer
246 views

How to stop player when they hit an axis aligned bounding box?

I'm in the process of creating a game using electron and HTML5. It's going to be a pretty basic story-based platformer, but I'm ...
Blue Herring's user avatar
0 votes
0 answers
45 views

How do i get this web app to use the up joystick button as an input

There is this reaction time test app that calculates the reaction time from the time you press a button, it works with the joystick buttons except for the directional buttons, this is the app: https://...
Amine Messai's user avatar
1 vote
1 answer
133 views

Randomly distribute damage among allies

Let's say I have regiments of varying sizes, 500, 1000, 4000 troops. I want to distribute 1000 troops worth of losses to them so that in aggregate they lose 1000 troops. I want to do it as a ...
Harry's user avatar
  • 167
0 votes
0 answers
73 views

How to create a basic strategic AI?

I started creating a Vue3 version of the classic Sid Meier game Colonization. I have the basic player mechanics in place and even created a map editor. So I have 3 of the 4X in place: Explore, Expand ...
Thomas's user avatar
  • 101
1 vote
1 answer
508 views

How can I protect against a cheater changing variables on the client?

I built a multiplayer fighting game with impactjs, socket.io and nodejs and faced with "change variables hack" (I want to call it like this). All my current logic with jump, running, shoot ...
李白 puer's user avatar
0 votes
1 answer
135 views

How to spread circles evenly around a point?

In my game there's a part where a bunch of circles need to evenly spread around a point. Like in this demo below: ...
Ryan Peschel's user avatar

1
2 3 4 5
29