if you try and run your code and check the console you will see that you’re script tags are incorrect.
<script language="javascript" type="text/javascript" src="libraries/p5.min.js"></script>
<script language="javascript" type="text/javascript" src="p5js-temp-platformetr7491295074039696125.js"></script>
<script language="javascript" type="text/javascript" src="p5js-temp-js_test3078609402461503628.js"></script>
you would need to add an libraries folder for the p5.min.js file. as for the other two scripts one of them you don’t need “p5js-temp-platformetr7491295074039696125.js” as it contains no code. the other needs to be renamed “js_test.js” so you would replace the above highlighted code with
<script language="javascript" type="text/javascript" src="libraries/p5.min.js"></script>
<script language="javascript" type="text/javascript" src="js_test.js"></script>
in your input handler functions a few things need to be changed
function setSignal ( setTo) {
if (keyCode == LEFT) {
holdLeft = setTo;
}
if (keyCode == RIGHT) {
holdRight = setTo;
}
}
to
function setSignal ( setTo) {
if (keyCode == LEFT_ARROW) {
holdLeft = setTo;
}
if (keyCode == RIGHT_ARROW) {
holdRight = setTo;
}
}
and
if (keyCode == UP) { //when up is pressed then increase flight value
flight+=15;
canJump1=false;
}
to
if (keyCode == UP_ARROW) { //when up is pressed then increase flight value
flight+=15;
canJump1=false;
}
further you don’t want to load images every draw but once in either preload or setup so you can move this code in the drawStage function
spike= loadImage("spike.png");
flag = loadImage("flag.png");
wallObstacle = loadImage("wallObstacle.png");
wallObstacleFlipped = loadImage("wallObstacleFlipped.png");
into the setup or preload function (probably preload is better) and one last thing change the draw order so your backgrond is drawn before all other objects else you won’t see the player etc.
do all of that and you will have something closer to what you are after but i have to say there are still issues and the way you have done some things are not optimal. it is probably a good idea to go and do some tutorials on creating 2d platformers i recommend this one as it is super simple and written in javascript which would not need alot of change to get working in p5js at least not as much as converting something from processing or java.
i’ll include this link to a sketch of your code which includes the edits i’ve recommeded above and you can look at as an example. i have commented out some code in the playerMove function as you need to address some collision related stuff first. anyways best of luck