4
votes
Accepted
ForEach vs For loop in JavaScript | Which is more efficient?
You should not micro-optimize code at this level, unless you have good reason to believe it is a bottleneck in your code. This is for a number of reasons:
1) optimization depends on the particulars ...
3
votes
Accepted
Besides 3d, why would I need to use a canvas instead of using plain css and html?
The CanvasRenderingContext2D API is working in a way that is more familiar to game developers. Game developers who worked with other 2d graphics APIs before are used to having a function which says &...
3
votes
Accepted
How do you setup a scrollable overworld map on an HTML/JQuery based game?
Well, Jay's answer was technically correct, and gave me a good starting point. So +1 to him for that. However, I wanted to take the time to post a fuller answer for others who happen across this ...
3
votes
Accepted
How can I publish a Python game on itch.io as html?
Since mid-2022, pygame has partial support for WebAssembly as upcoming python3.11 and allows for running the same pygame code on desktops and mobile/web.
To publish your game on itch.io as some people ...
2
votes
How can I publish a Python game on itch.io as html?
A game made with Pygame is not playable in the browser. Games made with that tool can be put on itch, but only as a downloadable desktop package, not as a web game.
For completeness, I should mention ...
2
votes
ForEach vs For loop in JavaScript | Which is more efficient?
The indexed for loop is a bit faster (not much, but it is), since the js engine doesn't have to look the properties of the object up before looping through them. It basically does your job when it ...
2
votes
Accepted
Technology behind retrogames.cc video games
If you right-click on a game on this site, you get this pop-up menu:
Clicking on "EmulatorJS v.0.4.24" takes you to this site explaining the JavaScript video game console emulator they use.
...
1
vote
Web application for efficient placement of blocks
In your if statement:
if (currentLeft + block.width > containerWidth) {
currentTop += block.height + blockMargin;
currentLeft = 0;
}
you're setting the ...
1
vote
Accepted
Why wont my code work
If you want to increase the first 10 times the variable clicks + 1, and after 10, clicks + 2 you need to make sure that the names of the variables in the code are ...
1
vote
Accepted
How do I react to a variable having reached a certain value?
If you want to reward the player with additional click power, then it would make sense to make that a separate variable, and use that variable instead of the constant value of ...
1
vote
Accepted
2D moving objects in angle
The Simple Approach: Sin and Cos
It looks like you're close. If you want to keep it simple, and assuming positive y is up and 90 degrees means go straight up and 0 degrees means go straight to the ...
1
vote
How do you setup a scrollable overworld map on an HTML/JQuery based game?
What you are looking for is the HTML5 canvas element. From w3schools:
The HTML <canvas> element is used to draw graphics on a web page.
1
vote
I keep coming across an error "Cannot read property 'innerHTML' of undefined"
You have written
document.getElementsByTagName('missile')[0]
and then later
document.getElementById('missile')
This looks ...
1
vote
Twine game animated blur effect
Generally speaking, the SugarCube format is more powerful, if you want to use Javascript.
For your question, you just have to put ...
1
vote
Accepted
Is reobfuscating javascript every time the page is loaded a valid option for a multiplayer game?
Summarizing the comment thread above:
No amount of obfuscation will stop cheaters. The most it will do is slow them down by a little - and if your game gets popular, the amount it slows them down will ...
1
vote
My HTML canvas keep flickering
Two things need to be improved in your code:
Preload images
Use requestAnimationFrame instead of setInterval
Demo:
...
1
vote
Accepted
Cap Framerate in the asynchronous world of Javascript
From the documentation:
Ticker.framerate = 30;
Hope that helps.
1
vote
Making a 2d shooting game. need a working shoot function
The array which contains your bullet (var bullets) is declared as a local variable within the shootGun() function. This already ...
1
vote
How to add a collision function to a game
So for collision detection and game development in general I suggest you start off with https://developer.mozilla.org/en-US/docs/Games/Techniques or
https://www.w3schools.com/graphics/game_intro.asp
...
1
vote
makeing a quest system in a html clicker. need help making repeatable quests and quests being done
You need an if statement to check against your variable. Such as:
if (clickedTotal == questClickAmount){
questPoints++;
}
This will insure that you will only ...
1
vote
Accepted
Problem with making camera follow player in Javascript
You just inverted the signs. The player's position should be the negative one and the canvas position, the positive one:
...
1
vote
Accepted
html/ javascript shop
To add onto @Xesenix's answer you probably want to make this generate it's own list, without you having to update the drop-down list each time. You do this by creating the drop-down through javascript....
1
vote
html/ javascript shop
To read current selected value from select drop down you need to modify is as follow:
...
1
vote
Is there a way to automatically group tiles in a A* pathfinding grid to find the largest areas?
I've heard this called "Room Generation" when used as an optimization to speed up A*. The only algorithm I know of is Rectangular Symmetry Reduction (though there are probably more)
It is described in ...
1
vote
Link CSS file with HTML file in Unity Power UI
The default href with PowerUI is resources:// so you don't need Resources/ just ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
html × 62javascript × 44
css × 14
html-canvas × 8
html5 × 6
web × 4
jquery × 4
unity × 3
c++ × 2
camera × 2
gui × 2
phaser × 2
php × 2
websocket × 2
opengl × 1
2d × 1
java × 1
libgdx × 1
mathematics × 1
game-design × 1
rotation × 1
directx × 1
tilemap × 1
path-finding × 1
software-engineering × 1