We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi to all, I'm new to programming and I'm learning it mostly from Khan Academy. Doing so I did some projects that I wanted to run off line, therefore I used a template to move it into an html page. First to test the template I tried to move a simple visualization to the html page and it worked perfectly. Then I tried to move my little game inside the html page but it didn't work. I think that maybe the problem is in the way I tried to load image but I'm not perfectly sure. Here a github link with all the files, under testtest folder there is the visualization that work. Thank you very much for your help, I tried everything but I'm still not able to figure what to do. Github link: https://github.com/LeonardoSaponara/Jump //I resolved the problem migrating to p5.js therefore I've updated the project on Github, see old commit to view the code at time of my question.
Answers
http://ProcessingJS.org/reference/setup_/
https://forum.Processing.org/two/discussion/8997/hoppy-beaver
Regarding the second link: I'm not searching for an Hoppy beaver port, I'm searching to use convert my program to an html file and my program share only some portion of his code with Hoppy Beaver. Regarding the first link I've to say that I've understood very little on how integrate a setup in this template, considering also that this template cover in another way some parameters of setup. Since the template work with another code ( Testtest in github links) I suppose that the problem isn't the setup but some other things, maybe the way on how I've loaded the image from the same local folder but I'm not sure.
http://processingjs.org/reference/pjs directive/
From the prev link:
So it seems this will apply to you. I was looking at your code and I would recommend to migrate it to p5.js. The reason is simple. With p5.js you have more versatility and more flexibility. Second, most of your code is already js. I ran your code and it seems the problem there is that it doesn't recognize the PImage. To me, it seems Processing.js is not doing its magic. It is just a suggestion but I would do it if I were you. However, I could see @GoToLoop taking on the challenge to make it work.
Kf
Thanks to kfrajer I've understood the problem: in javascript-only processing.js (so, as far as I've understood in a file different from a .pde) you can't use pjs directive and you should instead edit the Processing object, but I think it is not possibly to edit it to add images. The most viable solution for me so is to migrate to p5,js. An alternative solution would be download the Processing development environment,write down there the code producing a .pde file and then change and use the html file to call the code(not sure if this latter solution works but should). In my opinion is far easier and far time-saving migrate to p5.js.
This is my attempt. Notice one of your png filenames is not proper. Replace space with an hyphen. regarding image location, create a folder labeled data in your folder containing the html+javascript files and placed there all your images.
Kf
HTML
masterjump.js
Keyword: kf_keyword p5.js_demo p5js_demo