I wrote an entire game in processing (java), and now I want to put it online as a javascript game. If I just select 'javascript mode', it will partially run (meaning the background displays but you cannot actually play), and the firefox console gives me non-relevant error messages.
Is there a standard list of things to do when passing from java to javascript? Or at least a good way to debug it? (Firefox is useless).
My game works perfectly well in Java, but I think i did some ugly programming, such as give the same name to a variable and a function (which is fine in processing), and I did not write at all the words local, static, public, etc... cause I don't know what they're for...
I'm trying to start using javascript to code sketches with user interfaces on the web (ok, it is a game). I have no experience in networks so i just tried simple examples from the books of Reas-Freys, but I can't make them work. I tried the following code:
import processing.net.*;
Server server;
void setup() { size(400, 200); println("test"); server = new Server(this, 5204); }
void draw() { background(255);
println("test");
Client client = server.available(); }
The result is that "test" is only displayed once and firefox console displays
[07:39:24,327] uncaught exception: Processing.js: Unable to execute pjs sketch: ReferenceError: Server is not defined
Also the sketch log displays "Server started:
http://127.0.0.1:59095", which is clearly not 5204 (i tried other ports).
I don't have so much experience in OOP, but I'm trying to program a moderately complex game in Processing. It is not my first in Processing, but it is my first serious project.
I am having a recurring problem that I can't explain. I'm not copy-pasting all the code cause that's too long, so let me explain.
One of my arrayList, let's call it LIST, is modified dynamically by adding elements at some moments in the game. Actually, each time it is augmented by the current configuration of the game (a special class containing the current configuration, a variable that i call CONFIG - I write in caps to distinguish from my text here -).
Problem: When I try to come back to a previous configuration, the program actually calls the current value of CONFIG, and not the old one when it was supposed to be stored in LIST at that moment. As if what I was putting in LIST was not the actual value of CONFIG, but the address of the variable itself...I clearly checked in my program that the only moments where LIST is modified is by a .add method (no .set methods), so I don't think it is a mistake from me.
Sorry for the abstract explanations, I hope I made myself clear. I see really no way out of this.