Tag Info

Hot answers tagged

7

Web browsers disable some Javascript features for security reasons. My bet is that you just hit Google Chrome forbidding XMLHttpRequest on local files by default (see this answer on SO for how to disable that, but beware: this is dangerous). See this page on the Chrome dev site for details. This is why you have to setup a local HTTP server to workaround ...


3

At first glance, I would say you're going to have a problem with splicing during the loop. Say you're at index 1 and you have a collision. You then remove that spot, and now everything moves up a space. But your loop counter still increments. So what used to be in the second index is in the first one, and you went from the first to the second, skipping it ...


2

If you just open the game's root html-file in a browser, your browser will (hopefully) not allow that page to access any other files. This is a security feature that limits damage from malicious scripts. If you're comfortable on a command line and happen to have Python version 2 installed, an easy way to run a local web server is to change to the desired ...


1

If I understand correctly, you have a bullet "object" of size 36x6 colliding with an enemy of size 56x69. Let's take a look at each step of the collision: bullets[a].x + 36 >= enemies[b].x This will test if the bullet right side is to the right of the enemy's left side. Right after, you have this: bullets[a].x <= enemy[b].x + 56 Here, you test ...


1

You problem is in speed of checking for collisions. there are two possible solutions: Check several (n) times each frame (=move 1/n speed n times) Instead of point-rectangle intersection perform line segment - rectangle intersection the first solution is fast and easily implemented, on the other hand it doesnt really solve anything, if your bullets are ...


1

You have to draw the image at every frame when using canvas, you render the image once when calling ctx.drawImage, and thereafter you don't render anything to the canvas, so it stays the same.


1

I've had similar issues myself in the past. Serving Pages What your HTML file is possibly doing is sending HTTP requests to Localhost in order to load resources (such as Pixi.js), not actually requesting files. If not, Pixi.js may be doing that itself. This is useful behavior on a web server, as some of the things it might be requesting could be generated ...



Only top voted, non community-wiki answers of a minimum length are eligible