What's the deal with Deno? We talk with a major contributor to find out. Listen now.

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

Check bounds in 2d platformer level transition

I have asked How camera works in 2d platformer in level transitions about camera transitions, in the process I am stuck somewhere else. I have a targetRoom that is 32 by 32 tiles: ...
1
vote
2answers
65 views

Optimizing a quadtree for circles and circular queries

I'm developing a 2D ant simulation in JavaScript. I'd like to implement a quadtree to store the positions of ants and other markers. I approximate all of these entities as circles, and I'm only ...
0
votes
1answer
25 views

How camera works in 2d platformer in level transitions

I want to know how Camera works in game of Celeste. Currently what I have is, camera follows the player using interpolation: ...
0
votes
1answer
24 views

How can I implement a Boardgame.io project using Webpack?

I am following the boardgame.io tutorial, but I do not want to use either of the two implementation options covered in the tutorial (React and Parcel). The tutorial requires a framework or bundling ...
0
votes
0answers
30 views

What's a very fast and simple way to create a multiplayer online text-based game? [closed]

I’m working on a multiplayer online game and I need to know which tools to use and how to use them to accomplish certain tasks. The project is about creating sustainable multiparty agreements between ...
0
votes
0answers
19 views

The elements of a perfect juicy jump

I have seen and implemented these ideas: Simple Physics based Movement SO answer. Building a Better Jump GDC Talk. And written a tutorial about it Making a Platformer in Pico 8. Finally made a simple ...
0
votes
0answers
31 views

How to make a snake game where each snake tile follows it's connected tile

I want to make a basic snake game. It has a head and a series of tails that occupy a tile in a grid. The first tail in the series is adjacent to the head. and each tail that comes after is adjacent to ...
0
votes
1answer
20 views

Time-passed check with Pause functionality

I am working on a game that has a lot of time-passed checks of the following format. These work great, but there is a problem when the game is paused: If paused for any meaningful amount of time, the ...
0
votes
0answers
18 views

The rule to scale pixel art non multiple of integer ratios [duplicate]

I have pixel art, I want to draw. When player jumping I want to animate the art to squash stretch to have a feeling. But when I scale the art it get's distorted, as demonstrated in the image. In one ...
0
votes
1answer
14 views

How to leave trails that are equidistant apart from each other

I want bunch of circles to follow the player while keeping a distance apart. So far I have this: ...
0
votes
0answers
20 views

Algorithm for simulating collision between circles of different mass

First of all, I'm not sure if this is the right site for this question, as it's actually a game I'm developing. However, I thought that this would be a common thing to need to know in games, so I put ...
0
votes
0answers
15 views

Saving Complex Data to File Javascript

My game uses lots of complex objects to store game data. (Each block and entity has its own instance of a class) I am trying to create a saving and loading system, where the user can save game ...
0
votes
0answers
11 views

How to move a character from 1 to 3 squares on a grid?

I need to make a turn based game in js and jquery. The rules are : The 2 characters, the 4 weapons and the 15 obstacles are randomly generated on a grid(made with HTML table and generated in a loop) ...
0
votes
0answers
14 views

Spider physics to patrol on platform smoothly when changing direction

I have a 3 tile wide platform. I want my spider to hang from the ceiling and patrol this platform left and right. I have dx property for velocity. I want a physics code that shows how to achieve this. ...
0
votes
0answers
31 views

What are the parameters for a smooth wall jump

I want to make a platformer like Celeste and trying to implement wall jump. When the player is on the air and near a wall, and presses jump, the player gains x velocity opposite the wall direction, ...
1
vote
1answer
84 views

Are spritesheets worth it? Is a zip a good alternative?

I was wondering if spritesheets are worth it. I am making a game with pixi.js and was thinking about optimization, beginning with asset loading. I currently have an arraya of all files and use PIXI....
0
votes
2answers
39 views

Calling function every n second javascript game

I making a game and I want to call a function that runs every random second to spawn something every time. I've seen some posts that said to use the setInterval() ...
1
vote
1answer
40 views

Is reobfuscating javascript every time the page is loaded a valid option for a multiplayer game?

I am looking for ways to prevent cheating on a multiplayer browser game. I saw this answer where it was mentioned that obfuscation is not an effective technique. My plan is not only to obfuscate the ...
0
votes
0answers
15 views

Bubble Shader in Babylon.js

Can anyone think of an approach to creating a bubble-like material in babylon.js? I imagine a good starting point would be with using the Fresnel shader.
0
votes
1answer
16 views

Particle Turbulence Effect in Babylon.js

Is there any way to implement a turbulence effect in a babylon.js Particle System? I know that its possible to use physics engines on mesh objects, but I've not seen any discussion of using them on a ...
0
votes
3answers
115 views

Finding all possible paths from one hexagon to another

I got a hexagonal grid (cube coords) In hex (0,0,0) there is a soldier and in another (distance == 4 hexes) a target: i need to find all possible pathes from soldier hex to a target : 1)Length of ...
1
vote
1answer
29 views

2D Grid-based Pathfinding with Elevation

I'm creating an isometric game which currently uses A* Pathfinding on a basic grid representation of the map. Having elevations and allowing the Players to traverse up-and-down is an integral part of ...
0
votes
2answers
41 views

Default Game Window Size To Take While Making Games

I am planning to make a game for mobiles and tablets, I wanted to know what would be the default resolution that I should set for my game so that it covers all or most of the devices out there. I read ...
0
votes
0answers
11 views

Hide Environment Texture in Babylon.js

Is it possible to hide an environment texture as to preserve the reflections/light it provides while keeping the background transparent (as seen in picture 2)? I know this is done in Blender by ...
0
votes
1answer
35 views

Player hitting bottom of tile when beside it?

So my player checks if it is colliding with tiles, and it works pretty good. However, when the player is against a wall, moving upwards and sideways, it detects it as hitting the bottom of the wall ...
0
votes
0answers
16 views

Use JS to grab values from a dynamic Lua Table

((BACKGROUND: I'm modding a game that runs using Lua and the Source2 Engine (Dota). Gameplay logic uses Lua and HUD uses JS)) I used Lua to create a global table. For instance: ...
1
vote
0answers
23 views

How to show part of the world scaled to screen size?

I have a world size of 100x100 I want to map this world size to screen size using this mapTo function ...
1
vote
1answer
42 views

In regards to real time turn based games, where should the turn handler be?

I'm currently developing a pool-like browser game. I'm stuck on where should I handle the turn changing, timer, etc. Currently, turn timer (i.e. 15 seconds left to do action, then turn will change) is ...
2
votes
0answers
18 views

Electing a host with WEBRTC

This is similar to Host Migration (P2P) with RTMFP and AS3 I have a webRTC chat room, initially used Twilio and switching to skyway, the situation is that I have a bunch of peers with data broadcast ...
0
votes
0answers
18 views

How to properly resize canvas according to screen size? (Javascript)

So, as the question says I need to resize the canvas according to screen size. However the thing is that that's not it. I also need to have the mouse coordinates updated proportionally. Seems like I ...
1
vote
1answer
80 views

Javascript snake game, configurable section distance

I want to make a snake game. In a classic game the snake moves in 4 directions, I want the player to move in all directions by mouse input, similar to slither.io Right now the tail section changes ...
0
votes
2answers
32 views

How do I debug within an animation loop?

I'm trying to see some values within an animation loop, and am naively just console.log'ing when I need to, however, this usually results in the browser crashing ...
0
votes
0answers
12 views

Enemy explosion offSet is displaced away from desired point of origin

In the game, when the enemy is hit and explodes the explosion animation appears offset to the bottom right corner of the dead enemy's center point. I ran tests to adjust the explosion positioning ...
0
votes
0answers
13 views

Spawning objects inside rectangle JS

I'm making a JS game "Monopoly", where I spawning players in random position inside a rectangle. I need a formula that spawns circles INSIDE a rectangle, without being outside. Here what I have tried:...
1
vote
1answer
71 views

Completely Pixelated Font in JavaScript Canvas?

I'm making a game with a canvas scaled up such that each pixel is pretty big. I want to display some pixelated text without anti-aliasing but I have idea how I would accomplish this. Is there I way ...
1
vote
1answer
72 views

My HTML Canvas went blank

I tried to draw Mario Sprites in my HTML Canvas, but it always went blank. Anybody knows why? ...
0
votes
1answer
23 views

I can't clear the paint image in my Canvas

I'm trying to make the Mario move, but somehow it leaves traces behind, can anybody help??? ...
0
votes
0answers
32 views

Jumping a image in javascript

Which is the most efficient way to animate an HTML <img> element in vanilla javascript so that it jumps and falls back with acceleration. Edit: Im adding ...
0
votes
0answers
24 views

How to move 2D obstacle on Z axis in Javascript and HTML canvas?

I am trying to make a 3D-ish game where the player must dodge obstacles coming at them on the z axis. I have been trying for a long time to find a way to make it look like an object is moving on the Z ...
0
votes
0answers
27 views

Unity WebGL Canvas only loads on select machines

https://herbertjoseph.com There is a WebGL build in the background of this site, and it doesn't seem to laod on my iPad. I've asked a few people to visit and check it out, and some have said that the ...
2
votes
2answers
128 views

My HTML canvas keep flickering

I'm trying to create a game in HTML canvas, but somehow it keeps flickering, I've taken a look at the tutorial and I perceived that my code is more or less similar. Can anybody help me fix this? <...
-3
votes
1answer
72 views

What does this all mean for the enemy?

This enemy JS file in a space shooting game was part of tutorial but there was no explanation to what is does and more importantly Why. Can you please help me explain what the following mean in the ...
1
vote
1answer
50 views

How do I set bullets to shoot from the correct position on the sprite?

How can I set the bullets start position to shoot from the front right of the sprite? It is currently shooting from the top of the sprite. P.S. I'm doing a tutorial online with the sprite shooting ...
2
votes
0answers
591 views

Idle game: calculating resource generation/consumption

I'm making an idle game in the vein of Melvor Idle and I've run into a problem calculating the yield and consumption of resources while the user is away. For those who don't know, many idle games have ...
0
votes
1answer
22 views

Client Side Game Local Storage

I'm coding (or at least trying to code) a single player game in pure JS. I was wondering how I was gonna be able to write data without having the user setting up a server or a database, only way I ...
0
votes
1answer
33 views

how to join the body of snake in 2D snake game

i'm making a snake game in javaScript from scratch. The problem is that the snake looks disjoint(see image). How can I connect the body(rectangles) of the snake? here is the code of drawing snake: <...
1
vote
1answer
183 views

Phaser 3 - How to trigger an event every 1 second?

I have just started learning Phaser 3 and making a simple idle game, where you would gain x resources per second. What is the best/recommended way to do something like this? The two main ways I have ...
0
votes
1answer
131 views

Wall sliding in JavaScript; works, but gets stuck at corners

this is a follow up to this other question: How do I handle player collision with corners of a wall In inspiration of the code given in its answer, I tried to write some new code. Basically, in the ...
0
votes
0answers
61 views

html5 canvas isometric tile map

i need a help i have an Isometric Staggered tile map in Tiled (mapeditor.org). 100x100 tiles, 94x54px, 9447x2727px. total. How can i make this in html5 canvas ? var context = document....
0
votes
1answer
52 views

Implement spherical mapping for texture coordinates

I am using a texture of a world map and I am trying to put that image on a sphere made up of many triangles. Each triangle has points a,b,c with their own (x,y,z) coordinates. I am trying to use the ...

1
2 3 4 5
27