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
-4
votes
0answers
34 views

Why won't the ball appear? How do I make it appear?

I have the following HTML/JavaScript code for a Pong game. The ball does not appear. Why? And how do I fix it? ...
0
votes
0answers
16 views

Creating playable ads directly from a game in Unity

I need to research "playable ads", a form of digital advertising that isn't really new — when you've made a game in Unity, and you'd like to build an ad that truly represents the gameplay, ...
0
votes
0answers
19 views

solid color to sprite (javascript game)

Hi I recently created a javascript game, in this game, math random is used to pick a random shape. The shapes are in strings, and the associated numbers within the string are then used to show a color....
0
votes
2answers
47 views

Is it a bad idea to store functions inside components in ECS?

Say I have three entities: Player, Spikes, and Zombie. All of them are just rectangles and ...
0
votes
1answer
42 views

Implementing Seperating Axis Theorem

I'm trying to implement the Seperating Axis Theorem by following this article I found on MDN. Unfortunately, I'm not too geometry savvy and I wasn't able to find any good, simple implementation ...
0
votes
1answer
20 views

Line strokes also adding borders to other shapes?

When you run the project, you can see that the first circles have a black border around them. When I remove the Game.drawLines(), the circles don't have the border ...
0
votes
1answer
38 views

How to import three.module.js

I'm looking at this three.js cubemap example, and it runs fine in my browser when loaded from that page. After much strain to find and download the files - it does not run? What am I doing wrong, with ...
0
votes
1answer
45 views

Raycasting - weird lines on walls when ray is facing up or right

I am trying to make a raycasting game. Everything is rendered correctly except when the ray is facing up (angle > PI) or facing right(angle > 0.5PI and < 1.5PI) lines are drawn on walls. I am ...
0
votes
0answers
20 views

Top down four directional movement snap to tiles, not feel like crap

I want to make a topdown rpg movement, I need to update these parameters based on user input: User input four directions: ⬆️⬇️⬅️➡️ . Update parameters Position: ...
0
votes
0answers
16 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
105 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
38 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
44 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
22 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
34 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
20 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
28 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
16 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
33 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
89 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
49 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
41 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
32 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
27 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
118 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
35 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
60 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
21 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
25 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
44 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
20 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
25 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
84 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
16 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
153 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
78 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
24 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
41 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
29 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
28 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
269 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
2 3 4 5
27