I haven't been knighted... yet.
First it's better to get rid of the absolute path you have for all your media. If you want to use a directory within the project directory you just start with the directory name \ then the file. Once you get rid of the drive and path info it doesn't matter where the file is and it'll still find the media.
This:
load image "C:\Users\giz\Pictures\sprites\White_Plains.bmp", bgID
for i= 1 To 4
load image "C:\Users\giz\Pictures\sprites\whiteplain.bmp", platformID(i)
next i
load image "C:\Users\giz\Pictures\sprites\xstanding.bmp", 1
load image "C:\Users\giz\Pictures\sprites\xstanding.bmp", 2
load image "C:\Users\giz\Pictures\sprites\xwalk.bmp", 3
load image "C:\Users\giz\Pictures\sprites\xwalk.bmp", 4
load image "C:\Users\giz\Pictures\sprites\xjump.bmp", 5
load image "C:\Users\giz\Pictures\sprites\xfall.bmp", 6
To this:
load image "sprites\White_Plains.bmp", bgID
for i= 1 To 4
load image "sprites\whiteplain.bmp", platformID(i)
next i
load image "sprites\xstanding.bmp", 1
load image "sprites\xstanding.bmp", 2
load image "sprites\xwalk.bmp", 3
load image "sprites\xwalk.bmp", 4
load image "sprites\xjump.bmp", 5
load image "sprites\xfall.bmp", 6
When I first ran it the player seemed to just stay in one place even though he was "falling" so I added a few TEXT commands to see why it was in one place. The PlayerY variable was constantly going up so I was majorly confused when the player didn't move (see attached image).
That's when I saw this (where the remarks are):
Do
Anim = 0
paste Image bgID, 0, 0
for i = 1 To 4
Sprite platformID(i), platform1_X(i), platform1_Y(i), platformID(i)
Next i
If Jumping = 0
Old_Y = PlayerY
EndIf
Sprite PlayerID, playerX, playerY, imgNum ` Show player PlayerID = 1 - playerX and playerY change
JumpMax = Old_Y - 150
text 0,0,"PlayerX = "+str$(PlayerX)
text 0,20,"PlayerY = "+str$(PlayerY)
text 0,40,"Player Image = "+str$(imgNum)
gosub playerSprites ` Show Player routine
gosub playerInput
gosub playerAnim
gosub playerBoundryChk
gosub Title
gosub Gravity
gosub Collision
Sync
Loop
`-------------
playerSprites:
Sprite 1, x#, y#, imgNum ` Show player again x# = 100 y# = 100 - x# and Y# don't change at all
return
With two sprite commands showing the same sprite it keeps resetting the sprite to x# and y# so the player seems to never move. Get rid of one of those SPRITE commands and it'll run right. I'll let you decide if you want to keep the player sprite in the main DO/LOOP or change the one in the PlayerSprites route to use PlayerX and PlayerY instead of X# and Y#.
In the collision routine you can shorten it by putting the platforms in a FOR/NEXT loop and an EXIT once a collision has been detected. If you don't add the EXIT as you get more and more platforms checking all of them even though a collision has been detected would slow it down considerably.
Collision:
for i=1 to 4
If Sprite Collision (PlayerID, platformID(i)) = 1
falling = 0
Jumping = 0
PlayerY = PlayerY
exit ` Once a collision has happened leave the FOR/NEXT loop
Endif
next i
If falling = 0 and Sprite Collision (PlayerID, 0) = 0
falling = 1
Endif
return
To prevent the player from dropping off the left and right edges of the screen you can just add a reset of the playerX and playerY variables at the bottom of the PlayerInput routine. Also using INKEY$() is ok for checking keys but "r" and "R" are two different things... so if the user has caps lock on and you're checking for "r" it'll never detect that key. It's better to use KEYSTATE() instead so you don't have to worry about the case of the key and you can detect multiple keys at a time with KEYSTATE().
` Check for R key
If keystate(19)
PlayerX = 25
PlayerY = 0
Endif
` Don't allow the player to go off the left edge of the screen
if PlayerX<0 then PlayerX=0
` Don't allow the player to go off the right edge of the screen
if PlayerX>screen width()-image width(1) then PlayerX=screen width()-image width(1)
I noticed some of those variables are floats (the # symbol). Generally you don't need floats on anything that is never going to be a number with a decimal. Things like screen coordinates are never going to be half a pixel (like 100.5,320.5) and gravity that ultimately is going to be added to screen coordinates shouldn't either.
You really need to add more comments to your code to help you figure out what everything is doing if you somehow stop coding this for a bit and get back to it later. The more comments you have the easier it is to get back to old projects... believe me it helps.
I didn't see any platforms like the above picture to test the problem you're asking for... did you copy old code accidentally?