int PlatX = 400; //Platform X-coordinate
int PlatY = 300; //Platform Y-coordinate
PImage StonePlatform;
int yvel = 1;//Setting the speed of the platforms.
int blocklength = 100;//Setting the length of the platforms.
int blockheight = 10;//Setting the height of the platforms.
color c = color(0);//Setting the colour of the platforms.
int x = 470;
float CharacterX;
float Speed = 0;
float ystart = 534;
float jmp_speed = 10;
float Gravity = 0.55;
float CharacterY = ystart;
//(New Tab)
void setup() {
size(1000, 600);
CharacterY=60;
CharacterX=30;
}
You want to have many platforms, so you want to have a list of platforms. One Platform is described in the class Plat.
Since all platforms have a position, they have the same variables.
But each platform has different values in the variables.
Therefore platX and platY and many others (yvel, blocklength, blockheight and c) belong into the class and cannot be global variables.
Hello @Corn! To improve readability, kindly format your code by editing your post, selecting the code, and pressing the </> button. This will make it easier for us to assist you.