Stack Exchange Network

Stack Exchange network consists of 174 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

0
votes
0answers
20 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
36 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, "...
-1
votes
0answers
29 views

Class array is undefined

The problem I am having is a little hard to describe, but I have a floorDoc class that takes a .floor file and creates a ...
0
votes
0answers
9 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
22 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
0answers
18 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
23 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
22 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 ...
0
votes
1answer
79 views

How to use arrow keys to navigate between cells in a crossword puzzle

I am making a crossword puzzle, using a canvas. How do you get the keyboard arrows to interact with the screen so that when the user presses any of the arrow keys, the cursor will advance to the next ...
-1
votes
1answer
53 views

How to use JavaScript language in unity?

I recently read somewhere that the unity engine supports JavaScript language but I have a question. How to use JavaScript language in unity engine?
-1
votes
0answers
27 views

Key presses are not responding well

The key presses are responding once, then doing the automatic key presses. The code is below and you can see what it does below that. ...
1
vote
1answer
77 views

What should i use as a board for my game? [closed]

I'm a beginning programmer and i need to make a game. The rough idea revolves around fleets fighting in turn based battles while you control your factions resources and manpower. The original concept ...
2
votes
1answer
23 views

Why does the first red-zone sometimes appear too close to the border in my battle-royale red-zone feature?

The Problem: If you've ever played or watched some gameplay of a battle royal game (like PUBG, for example), you'll always find an event during any battle called the red zone. Basically, at a ...
0
votes
0answers
54 views

How do I load tile map with phaser 3

I created a simple tilemap with tiled, and I'm trying to load it. The code and files can be seen here: https://codesandbox.io/s/qqq47wqv3w I'm not getting any errors in the console, but the canvas ...
1
vote
3answers
224 views

RPG quest system

So I have made a small RPG where you can create char, update skills, buy items, fight other users etc. Now to make the game more extended I need quests. And I need a little bit of help here. Right ...
1
vote
1answer
44 views

Bump and push entities without a physics engine

I have seen on many games the ability to push entities around and bump into enemies/characters. What is this called? I have implemented Matterjs to accomplish this with Pixijs but it seems overkill ...
0
votes
1answer
35 views

detect collision between two circles and sliding them on each other

I'm trying to detect collision between two circles like this: ...
0
votes
1answer
58 views

Canvas HTML5 Top View -> Isometric

We are working in a simple MP strategy game using Node, Express and Sockets! I'm wondering if there's an easy approach to a transformation to make a Top View game into a 3D Isometric, without adding a ...
0
votes
1answer
27 views

PhaserJS: Detecting intersection

I'm making a card game to get my legs with phaser. I have an row of overlapping, face down cards. I want to detect when any card is covered by another card. The deck is shuffled before being placed ...
0
votes
1answer
44 views

how to draw a dashed path in Javascript

I need to draw a brick curved path but i need to be able to put an arrow pointing to any a brick by API. something like this: i thought to use canvas but i'm not sure i can get a reference to each ...
3
votes
1answer
117 views

How to reduce the total time spent checking against my world bounds?

I'm making a game engine and currently I use a function for checking a new position after movement to prevent game objects from escaping the world: ...
1
vote
1answer
57 views

HTML5 game pases when you go to another tab

I'm making a simple game and I use requestAnimationFrame. Now the problem is that each I change to another tab the game pauses and when I return the game continues. ...
1
vote
3answers
78 views

Splice enemy array to destroy enemy (js game)

I am currently working on a basic space invaders game. So far I have created the enemies, a main character, and a laser beam, collision detection between enemy and bullet, however when my bullet ...
0
votes
1answer
56 views

Realtime Multiplayer - How to handle user updates coming in different times

I have a game loop that sends new positions of every player to other players. But there is no guarantee that the users will send the server their new positions at the same time. Actually if their ...
0
votes
1answer
37 views

Why can't I load images in processing.js and let them be dynamic?

I can't easily load images. I can only render an image once unless I put this: <img src="images/papermario.png" hidden></img> in my html. I also still ...
0
votes
2answers
180 views

Implementations for storing entities in an ECS system

I'm restructuring my model of entities, components and systems, where entities are: ...
-1
votes
1answer
82 views

Game engine with javascript scripting [closed]

Javascript is my favorite language and a few years ago Unity had a options to create JS scripts but its removed for now. So is here any strong engine like Unity wich still support JS for scripting?
-1
votes
2answers
159 views

How do I calculate the total XP to reach a particular level, when each level takes 10% more?

How do I calculate the amount of XP for a level where the first level is 110, and each level after is 10% more than the last. Preferably to do without a loop because the levels will have to be ...
0
votes
0answers
37 views

How should I make a Tile-based Plat-former engine using Processing js?

I'd like to know what structures I should use for creating a Tile-based Platformer. I've created platformers before using processing js. Is there any documentation on this? Before I do this I'd like ...
0
votes
1answer
25 views

Setting a jump counter in my 2d platformer built with phaser

I have a platforming game, written in javascript with the Phaser.js framework, where my character collects objects. I thought trying to collect all objects in the least amount of jumps would be ...
0
votes
2answers
78 views

Why is my spritesheet displaying all messed up in game?

I'm having an issue I don't quite understand, where my spritesheet is looping strangely and not showing the full sprite I want, even though I feel like I'm specifying it correctly. My code is in ...
1
vote
1answer
52 views

Efficiently calculate 2d world position based on parent(s) recursively

I am writing a small 2d html5 game engine in javascript that relies on the concept of a hierarchy. The scene is the root node or entity, and its children make up the game objects. These children can ...
0
votes
1answer
28 views

How can I add acceleration to the movement of an object in a game

Below is the code that I'm using to move an object: ...
0
votes
0answers
25 views

isogenic game engine: how can I read what state an entity in the user interface?

I recently found this engine, this engine as far as I know have limited documentation. I hardly found tutorial except from it's website ...
0
votes
1answer
51 views

Checking distant 2D objects from the player in pure javascript

I'm checking if the objects are too far from the player to be able to disable some things, I'm doing so: ...
0
votes
1answer
26 views

Getting an object to move in another objects direction

I have a player and an enemy, both have x and y values, and I want to move the enemy to the player and have them 'touch' over time in a speed that I can determine, I tried calculating the angle ...
0
votes
0answers
54 views

Draw objects that move on an “infinite” map

I'm generating a game map using a mod function, so when I reach the boundaries of the map, I start generating the map again, I can generate the tiles by moving my character correctly, and when I reach ...
0
votes
1answer
143 views

Javascript-How to create a moving bullet animation from canvas

the bullet cant see to move at all ...
1
vote
3answers
84 views

Draw the HUD just once on the canvas

I am not able to draw only one HUD of my game on a separate canvas, so I do not have to redraw it to each frame, I have four functions, init(), render(), loop() and drawHUD(): init() is my function ...
1
vote
1answer
74 views

How to avoid rows on screen when cutting spritesheet tiles?

I'm having a problem with my spritesheet, I generate a map but when I zoom in on it I can observe these lines as in the image below: When I used the tiles each in their separate image, that did not ...
1
vote
2answers
64 views

Simulating Enums with Javascript

When developing in Javascript, it seems useful especially for event systems to use enum-likes, but not string comparison for performance considerations (also because it doesn't protect against typos). ...
0
votes
3answers
341 views

How to optimize collisions

I'm building a 2D MORPG using JavaScript, Node JS and socket.io To prevent cheating, I have to run all collisions for all players on my server. I'm currently doing fairly simple square collisions ...
0
votes
1answer
291 views

How to prevent (most) cheating (server-side) in my JavaScript, Node JS, socket.io MORPG?

I'm working on a fairly simple JavaScript + Node JS + socket.io (M)MORPG where multiple people play in the same world. This is actually working, but cheating is insanely easy at the moment. My goal ...
2
votes
1answer
84 views
0
votes
0answers
33 views

Handling “nested” user actions in client/server card game

I'm developing a card game in JavaScript in a functional programming style and I'm unsure what is the best way to implement the flow of player actions that require other player actions for their ...
1
vote
1answer
41 views

Online Browser Game Resource Incrementing Production Problem

I am working on a browser game where there are citys and their resource productions. Each player has their own production rate for each resource.Lets say stone as example. I have production rate,...
0
votes
0answers
62 views

Collisions between two objects in 2D space

I am implementing the collisions of my game in javascript, and at the moment what happens when the objects collide is that they have their speed changed to 0. What I'm starting to want to do is to ...
0
votes
0answers
21 views

Box2d detect separated none blocking floor as blocking wall

I'm trying to make my character walk on walls, it all goes okay-ish currently until this situation. Here's an image to show you how the wall looks like https://www.dropbox.com/s/5oyn55qpzljlhnl/...
0
votes
1answer
189 views

Camera with zoom that follows the player in javascript

I'm passing the time programming a little game in javascript, I've done what I'm trying this in several in game engine. And what I'm trying to do is generate the world while the player walks around ...
1
vote
0answers
74 views

Performance problems with scrolling html5 canvas for large tile-based game

I try programming a splix.io clone as an electron app and do the visualization via the html5 canvas. The movement across the tiles should look fluent like the original, so I target 60 frames a second. ...