Back again. This portion is part of one of my levels where i have 5 levels with platforms the “player” (shape) is suppose to navigate through with out touching. on my previous level i was able to make to 2 levels with platforms and the player wasn’t able to move through the platforms.
The problem is now i guess because i have so many platforms at different heights that action doesnt work for every platform drawn…
Could anyone tell me what wrong?
Some Variable info
int platformY = 450; // the green platform at the bottom. //set Width and height. The x and y-vaules here at the starting set points. int time; // for my text to appear and disappear.
*int playerWidth = 30; * int playerHeight = 30; int playerX = 250; float playerSpeedY = 0; float playerY = 50; // how fast the player moves
please don’t post screenshots but post your entire code as text.
Format it with sign </> in the small command bar.
thank you!
because i have so many platforms at different heights that action doesnt work for every platform drawn
You don’t say precisely what your problem is and we can’t run your code.
The usage of ==
You often say if playerY == ; the usage of == might be a problem because when the playerY is 176 instead of 175 it wouldn’t match. Consider if(playerY > 170&& playerY <179 …
Also, you could use if...else if.... because when the player hits one platform he is not hitting another one in the same frame.
If you can, you could make an array (see tutorials on the website) of platforms and for loop over them. Would really shorten your code.