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

202 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
0 answers
277 views

How can I call a native mobile API in Construct 2?

How can I use mobile API features in a Construct 2 game (HTML 5/JavaScrit engine)? I didn't find anything about that on the net, unlike other game frameworks like Corona Enterprise or Cocos2d.
Burrich's user avatar
  • 161
4 votes
0 answers
213 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 ...
Ced's user avatar
  • 143
4 votes
0 answers
67 views

Why does interactive cloth not appear in game view in unity5 Pro?

I used interactive cloth fir flags in unity5 Pro version and it appears in scene view but does not appear in game view while playing. What can I do for that please somebody help me out?
Shraddha Patel's user avatar
4 votes
1 answer
1k views

HTML5 Canvas - Drawing with Floats

I'm trying to implement a game where you have car moving along a line in HTML5 Canvas. Using a little bit of trigonometrie I managed to get the right x and y coordinates to add to the coordinates of ...
JasonMs's user avatar
  • 41
3 votes
0 answers
974 views

What is causing my touchstart event to end while I'm still touching the screen, and how can I fix that?

What I'm trying to do: I'm trying to add touch controls to games created with the html canvas and JavaScript so that they can be used on mobile / tablet devices. The controls should simply move a ...
Fishbite's user avatar
3 votes
1 answer
176 views

Storing stateful function-based actions in a JSON

System: My game uses an "ECS + event queue" architecture where every tick, various events change the state of JSON-able data. Plain JS objects. Problem: I want to be able to save the game-...
Hypergardens's user avatar
3 votes
0 answers
192 views

Game runs at different speeds in Chrome versus Firefox

I am using Box2D for physics on the server side. Player position is updated on the server, so there is nothing the client can do except give input. But running game in Chrome only, the player moves ...
JustStarted's user avatar
3 votes
0 answers
2k views

Phaser: Scaling to fill screen, maintain pixel ratio, but not aspect ratio

I've used libraries in other languages before that provide different types of scaling via viewport types. The best example of what I want is from a library called libgdx for Java, their ScreenViewport....
Samson Close's user avatar
3 votes
0 answers
135 views

Optimising my Node.js/Js/Socket shooter game

So here I made a little shooter game just to play around with and on my pc it runs fine but for people with worse internet/less powerful computers (e.g at school/few friends of mine) it is quite laggy ...
JohnT's user avatar
  • 43
3 votes
0 answers
68 views

Allowing one sprite to move through another in Quintus

I have a Bumper class extended from Sprite: ...
user avatar
3 votes
0 answers
1k views

Change color of bitmap

I am attempting to understand the easeljs ColorFilter and its use with cache. There is quite a bit of information at the easeljs site but it's not clear based upon the examples and documentation. ...
McArthey's user avatar
  • 205
3 votes
0 answers
139 views

Image won't scale after click

Despite being a long-time developer I've never played with JavaScript libraries or any sort of graphics development. With my son we're trying to create something interesting and are using createjs/...
McArthey's user avatar
  • 205
3 votes
0 answers
826 views

Drawing a hexgrid on a canvas, yet making it zoom/scrollable?

I'm developing a game in JS / PHP. The game is basically a 2D plane (hexgrid) where each hex represents a location in space. In total, I'm drawing 25 * 25 hexes on a 1000x1000 canvas. I also draw ...
Christian Finke's user avatar
2 votes
0 answers
80 views

Tell if two polygons are colliding

I want to make a function like areColliding which takes two polygons as args. I also want to cover cases like and the dreaded because I am trying to create a ...
user avatar
2 votes
0 answers
39 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 ...
exrhizo's user avatar
  • 21
2 votes
0 answers
1k 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 ...
RoboticWater's user avatar
2 votes
0 answers
1k views

How can I build Goal Oriented Action Planning within an Entity Component System?

I've been creating an interactive fiction game in javascript that uses an entity component system as described here. The problem I've encountered is in developing the AI system for the game. Ideally, ...
pigasus's user avatar
  • 21
2 votes
0 answers
564 views

2D platformer:How to avoid "bouncing descend" when walking down slopes?

I've been working on implementing slope collision by SAT(Separating Axis Theorem). And then I have a trouble. When my character walks down slope, it moves like a bouncing ball: The slope has 3 ...
undefined000's user avatar
2 votes
0 answers
2k views

Detecting collision of multiple moving objects

I have wrote a simple game that has a 100 balls bouncing off the borders of the canvas. Each ball is an instance of ball class function that has the following ...
Ahmad's user avatar
  • 121
2 votes
0 answers
732 views

My collision detection is not working when I rotate my mesh in three.js

I am trying to move a ball mesh through a maze. The maze belongs to a parent object3d. My issue is that when I move the ball I can't detect collision right well because in the rotation, the axis ...
myhappycoding's user avatar
2 votes
0 answers
188 views

Phaser: Shader Chain

I want to implement lighting via shadowmaps. I see process as: 1) render something to RenderTexture1(size as game) 2) create RenderTexture2 (custom size) 3) add it to Image2 (custom size) 4) apply "...
Fen1kz's user avatar
  • 173
2 votes
0 answers
989 views

Implementing Separating Axis Theorem to Detect and Handle Sliding Collisions

I am having a bit of difficulty detecting collisions properly with separating axis theorem. My code seems to be giving a lot of false alarms. Also, I've looked into implementing sliding collisions ...
Rjdlee's user avatar
  • 121
2 votes
0 answers
311 views

how to detect if a line is crossing another shape in javascript?

given the situation here http://jsfiddle.net/h902cLpy/ is it possible to detect that a line going from A to B does cross another shape while A to C doesn't?
topcat's user avatar
  • 21
2 votes
0 answers
414 views

How can I mimic an isometric perspective using square tiles?

Can an isometric perspective be mimicked with traditional square tiles? Can't the effects of the 45-degree overhead view simply be "drawn in" to the square? How would this work? Picture this: the ...
Chris Scott's user avatar
2 votes
0 answers
146 views

p2.js physics engine behavior on Heightfield

I am writing a small game consisting of a 'ragdoll' character riding a skateboard. I have created a 'skateboard park' with some ramps and a jump. I am using a 'heightfield' object as the ground. ...
smatthews1999's user avatar
2 votes
0 answers
1k views

Converting coordinate systems to/from an isometric game world

I have tried searching and reading for an answer, but the information I could dig up either didn't fit what I need or was in the form akin to "Just multiply the vectors with the inverse matrix of.." ...
PlastBox's user avatar
2 votes
1 answer
1k views

finding the angle to launch a projectile at a 3d coordinates

I have a game where the user can shoot a bullet and the bullet flies through 3 dimensional space and eventually hits the ground somewhere. My question is how can I calculate the ...
ZeroByter's user avatar
  • 121
1 vote
1 answer
103 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
1 vote
0 answers
95 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
1 vote
0 answers
141 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
0 answers
392 views

Aircraft simulation

Trying to get a "semi" realistic aircraft simulator. I'm pulling my hair out because I just can't get the math right. I'm not looking for super realistic but want to at least get some ...
K2xL's user avatar
  • 111
1 vote
0 answers
593 views

How to make an update loop in a Node.js game server

I'm making a multiplayer game with a Node.js server, and I'm searching for how to write the game loop. I'm currently using a setinterval every 15ms, but someone ...
Wild Royal's user avatar
1 vote
0 answers
142 views

Jittery entity Interpolation when tick-rate exceeds framerate

In my current game implementation, our game servers send data to the clients only 10 times per second (~every 100ms). However, due to recent changes, we are now expected to change the server tick-rate ...
CodeMonkei12's user avatar
1 vote
0 answers
40 views

How can I make this motion collide against a wall

EDIT I've actually commented out the motion in my code and adapted it to try reproduce this post.After a chat with @DMGregory he told me to use velocity reflection but as you can see in the following ...
JSmith's user avatar
  • 123
1 vote
0 answers
685 views

How to play multiple sounds at once without reloading data?

I am making an HTML5 game, which involves one audio being played multiple times at once. I searched this issue up and found this: https://stackoverflow.com/questions/25654558/html5-js-play-same-sound-...
Coder2195's user avatar
  • 123
1 vote
1 answer
854 views

How to perform a sliding collision between a square and a circle?

Please point me to the duplicate if this has been asked before. I couldn't find it. Basically, I am creating a 2d top-down game where the player is represented by a circle, and the tiles are ...
Ryan Peschel's user avatar
1 vote
0 answers
71 views

Tagging "regions" in rot.js map generator

I'm working on a small roguelike and I'd like to be able to tag the various "regions" generated via the Map generators so that I can use it as a lookup to environment descriptions. I see ...
erik's user avatar
  • 1,378
1 vote
0 answers
48 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 ...
eguneys's user avatar
  • 247
1 vote
1 answer
642 views

RayCasting with Mode7

I'm trying to join the mode7 algorithm with RayCasting. For mode7, I'm using a simple rotation matrix to implement the rotation. The result is a little strange and I can't fix it. Do you know what is ...
Vinícius Biavatti's user avatar
1 vote
0 answers
333 views

How can I use canon.js in three.js editor?

I would like to add bullet physics to a scene crated by the three.js editor. Where do I need to put the canon.js file in order to be able to access it's functions from the editor scripts? I ...
John Domboroczki's user avatar
1 vote
0 answers
62 views

Problem with collisions detection on canvas platformer

Having a lot of trouble with my collision detection in my platformer. If you go straight to the right the block will float. Also the corners let the block sink right through and the walls are sticky. ...
Charlie K's user avatar
1 vote
1 answer
254 views

Making a way to fight monsters in my clicker game

I want a working next and previous button for killing monsters http://prntscr.com/o375y7 http://prntscr.com/o37609 Im new to this concept so i don't know how to go about doing this. html code(all i ...
tmanrocks994's user avatar
1 vote
2 answers
136 views

Select Neighboring X or Y Tiles

I have a randomly generated set of tiles, and I am trying to select neighboring x or y tiles to perform functions on them based on if they are a certain value of tile, like so: ...
Dustin's user avatar
  • 11
1 vote
0 answers
48 views

Where to store constantly changing game data such as duels data?

I'm making a discord bot which allows players to collect and duel cards. All the cards, players and other data is stored in MongoDB but where should I store duels data? Duels data will keep changing ...
Light Yagami's user avatar
1 vote
1 answer
440 views

Behaviour of containers in Phaser 3 framework

I don't understand the behaviour of containers in this example: Phaser example The part I don't unerstand is line 41. Why is lastContainer assigned to newContainer? In line 40, newContainer is added ...
Piotr's user avatar
  • 11
1 vote
0 answers
42 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: ...
Albert's user avatar
  • 41
1 vote
0 answers
89 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 ...
Knuckles209cp's user avatar
1 vote
0 answers
230 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 ...
Anton Medvedev's user avatar
1 vote
0 answers
95 views

How to fix html canvas sprite trail when moving to the right side

I have moving background on character movemet. When I move to the sides, I get stacked images, so I found out that I need to clearRect every time to avoid this. But clearing canvas leaves me with ...
Limpuls's user avatar
  • 189
1 vote
0 answers
123 views

How do I fix these touch events? Events respond if there are 2 fingers but not 1

I am making a simple game of mine mobile-friendly. The goal is to: Make character walk if a touchstart event is sensed on right half of screen. Stop character if a touchend event is sensed on the ...
JGoss's user avatar
  • 11

1
2 3 4 5