Processing.js code on openprocessing - nothing happens when you click

I’ve been using to create a processingjs code but something is going wrong where nothing happens when you click on the main screen but it’s supposed to change to the tutorial screen. I’ve been trying for a while to figure out the problem but I’ve had no luck.
NB: the code that isn’t working worked before in an older version but when i decided to start over and copy that code over it stopped working.
A link to the code:

1 Like

OK, no use to have certain stuff in setup()

your draw()

I made this your draw() :

void draw() {
        // that’s your drawing function - NOT setup() please 
	background(0);  // always good to have this 
	if (level == 1)  // no semicolon here !!!!!!
		playerX = playerX + 2;
	if (gameScreen == 0) {
	else if  (gameScreen == 1) {

your setup()

That’s your setup() function now

void setup() {
	size(screenX, screenY);
1 Like

I can‘t see how the Code is supposed to show the Tutorial screen. You‘ve made it a function, but you never call it… Not in setup (though you‘d not need it there), not in draw and not in keyPressed()… and there‘s no function to even check wether the Tutorial should show or not…

1 Like

We wrote at the same time…


1 Like

Welcome to the forum!

Great to have you here!

Regards, Chrisir

Thanks for responding, you’ve been a great help! :blush:

1 Like


var platform1X=133, platform1Y=222;
var platform1Width=33, platform1Height=7;

var groundY=444;

var playerSpeedY = 0;
1 Like

And also do me a favor

Don’t code the platforms like this

Read the tutorial on arrays

And make 4 parallel arrays for x y w h

so you have the data for the platforms in arrays

Then you can for loop over them to display them and to check for collisions

yep, i will do that. Thank you!

1 Like