Just adding this for the people not looking to read a whole bunch of text, at least read this and look at the picture to understand my question; I have collision set up between the "player" and "objects", so that when the "player&...
I have got a little function in javascript and I want to split an array A into a 2d array. I will be used for square matrices. Obviously,I want it to be 2x2 if a square matrix of 2x2 is in the input and so on for 3x3 and. But I'm stuck after havi...
i want to use the phones accelerometer for rolling a Ball in a Ball. The movement works correctly, the problem is that when the ball hits the Wall. How can i get a smooth rolling animation that the ball slides along the inner side of the bigger ball?...
I have a rather simple bird's-view 2D game where tower sprites defend against incoming moving sprites by shooting a bullet at them. My question: How do I calculate the needed bullet speed for the bullet to reach its moving target, provided that t...
Solved, see bottom of post for final algorithm  Background: I am working on a 2D platformer using JS and the HTML canvas element. The level map is tile-based, but the player is not clamped to the tiles. I am using a collision detection algorithm outl...
I've taken code that's heavily inspired by this answer but my projectile is not homing in the way I expect.  The initial projectile direction is often perpendicular to the target.  At which point, it does seem to home in on his direction, but...
I'm building a simple tile-based 2D game in JavaScript, and I want to know the best way to store map data on the client.  On the server, I store the map in 64x64 chunks and I'll request the next three sets when the player enters a quadrant of...
var i = 0; var x = 960; var y = 540; var interval = window.setInterval(render, 100);  function render() {  gradient = cxt.createRadialGradient(x, y, i, x, y, i+10); gradient.addColorStop(0, "rgba(0,0,0,0)");//white inside  gradient.addColorSt...
I'm making a tetris type demo using ThreeJs. For rendering, I'm using requestAnimationFrame. Snippet:    game.prototype.render = function(){ 	var thisObj = this;  	requestAnimationFrame( function() {thisObj.render();} );  	var now = new Date(...
This screenshot and code snippet will show you my trouble. How to avoid this? May be I do this in wrong way? I would like to see some code example, if possible.      let canvas = document.querySelector("canvas"); 	let ctx = canvas.getContext(...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.