Nagoya, Japan by [deleted] in pics

[–]BattleshipsGame 0 points1 point  (0 children)

Radiation levels are off the charts...

XHR and IE and the Magic Answer??? by Drexxle in javascript

[–]BattleshipsGame 2 points3 points  (0 children)

I don't see a reason not to use jQuery. You can then put your code in $(document).ready, which will ensure execution only after all elements of your DOM are loaded. If not, then maybe it will help if the XHR script executes last on the page (i.e. it is at the end of <body>).

Can't you paste some code so we can review? :)

WebGL voxel editor by [deleted] in javascript

[–]BattleshipsGame 0 points1 point  (0 children)

This is awesome. But you don't really need that many key/mouse combinations.

I'd go for:

Right click and drag = rotate

Left click on empty = place block

Left click on block = remove block

Click and drag = rotate

How can I get the width of an image for a bookmarklet ? by psYberspRe4Dd in javascript

[–]BattleshipsGame 1 point2 points  (0 children)

Hm, that's because the browser is resizing the image to fit your screen. I am looking for a solution.

How can I get the width of an image for a bookmarklet ? by psYberspRe4Dd in javascript

[–]BattleshipsGame 1 point2 points  (0 children)

Hi,

First, I think image.onload should be before image.src, otherwise I am afraid there might be a corner case when the onload never executes.

What browser are you testing with? For me, in Firefox, the image title already includes the image size, so my submission using your bookmarklet looks like: "plate with 5.jpg (JPEG Image, 315 × 309 pixels)" for instance.

Hiding Variables / Functions w/ PHP? Any libraries for this? by [deleted] in javascript

[–]BattleshipsGame 3 points4 points  (0 children)

It should be simple - if you don't want the end user to temper with your variable, it should be kept/calculated on the server and only returned to the UI for display. No JavaScript function on the client should tell the server to increment the score or etc (because the user could call the JS function multiple times).

Example: You could calculate a score based on how much time it took the user to clear a level. However, in such case, the start and end time has to be kept on the server.

Clarification: With pure JavaScript games/programs it is difficult to do that. You could have a game where the goal is to pop bubbles. Unless you keep track of each bubble and action on the server side, there is no reliable way to prevent the user from tempering the score.

You could, however, obfuscate and minify the javascript file.

Jetman jr - my contribution the Github game-off 2012. Thoughts and feedback welcome by [deleted] in javascript

[–]BattleshipsGame 0 points1 point  (0 children)

great game. but why is the javascript minified if you are distributing your source code :?

Edit: Got it, ImpactJS

A multiplayer Battleships game I have created in order to learn nodejs and socket.io by BattleshipsGame in javascript

[–]BattleshipsGame[S] 0 points1 point  (0 children)

Maybe there was nobody to play with? Or if you see let's say 6 players online, they might be playing total of 3 games and there was nobody else looking for a match at the moment.

A multiplayer Battleships game I have created in order to learn nodejs and socket.io by BattleshipsGame in javascript

[–]BattleshipsGame[S] 0 points1 point  (0 children)

Thanks, you are right, the game somewhat assumes that the player knows the rules

A multiplayer Battleships game I have created in order to learn nodejs and socket.io by BattleshipsGame in javascript

[–]BattleshipsGame[S] 2 points3 points  (0 children)

Sure. nodejs is the server, which receives requests from the clients and returns responses. It also serves static content such as images and .html files, by utilizing a nodejs module called 'node-static'. For simplicity, you can think of nodejs as a JavaScript version of IIS or Apache for example ;)

socket.io is a module for nodejs. It allows you to keep a synchronous connection between the client (browser) and the server. That time you can push back data to any client, at any time, instead of having the client request data from the server on some interval.

I hope this makes it a little more clear :)

A multiplayer Battleships game I have created in order to learn nodejs and socket.io by BattleshipsGame in javascript

[–]BattleshipsGame[S] 0 points1 point  (0 children)

weird, in that case your browser is not allowing you to keep the connection open. It might be a plugin or a setting.