Here's a simplified solution using your code:
SetVirtualResolution(427, 320)
SetOrientationAllowed(1, 0, 0, 0)
SetSyncRate(60, 1)
SetClearColor(0, 0, 0)
SetPrintColor(255, 255, 255)
SetPrintSize(16)
global Sprite1
global Platform
global PlatformX
global PlatformDirection
global Movement
Sprite1 = CreateSprite(Sprite1)
SetSpriteSize(Sprite1, 20, 40)
SetSpriteColor(Sprite1, 255, 0, 0, 255)
SetSpritePosition(Sprite1, 230, 280)
SetSpritePhysicsOn(Sprite1, 2)
SetSpritePhysicsCanRotate(Sprite1, 0)
rem don't need to edit friction
`SetSpritePhysicsFriction(Sprite1, 1)
Platform = CreateSprite(Platform)
SetSpriteSize(Platform, 100, 20)
SetSpriteColor(Platform, 0, 0, 255, 255)
SetSpritePosition(Platform, 190, 240)
SetSpritePhysicsOn(Platform, 3)
rem put the platform in a group
setSpriteGroup(Platform,1)
SetPhysicsGravity(0, 200)
do
Movement = GetDirectionX()*100.0
remstart
if GetDirectionX() > 0
Movement = 100
elseif GetDirectionX() < 0
Movement = -100
else
Movement = 0
endif
if GetSpriteX(Sprite1) <= 0 AND Movement < 0
Movement = 0
SetSpritePosition(Sprite1, 0, GetSpriteY(Sprite1))
endif
if GetSpriteX(Sprite1) >= 480 AND Movement > 0
Movement = 0
SetSpritePosition(Sprite1, 480, GetSpriteY(Sprite1))
endif
remend
//SetSpritePhysicsForce(Sprite1, 0, 0, Movement, 0)
//SetSpritePhysicsImpulse(Sprite1, 0, 0, Movement, 0)
//SetSpritePhysicsVelocity(Sprite1, Movement, GetSpritePhysicsVelocityY(Sprite1))
rem get current velocity
x# = getSpriteXbyOffset(Sprite1)
y# = getSpriteYbyOffset(Sprite1)
if PhysicsRayCastGroup(1,x#,y#,x#,y#+getSpriteHeight(Sprite1))>0
ID = getRayCastSpriteID()
setSpritePhysicsVelocity(Sprite1,Movement+getSpritePhysicsVelocityX(ID),getSpritePhysicsVelocityY(Sprite1))
else
SetSpritePhysicsVelocity(Sprite1, Movement, GetSpritePhysicsVelocityY(Sprite1))
endif
if GetRawKeyPressed(32) = 1 OR GetPointerPressed() = 1
if GetSpritePhysicsVelocityY(Sprite1) = 0.0
SetSpritePhysicsVelocitY(Sprite1, Movement+GetSpritePhysicsVelocityX(Sprite1), -200)
endif
endif
PlatformX = GetSpriteX(Platform)
if PlatformX < 100
PlatformDirection = 0
elseif PlatformX > 280
PlatformDirection = 1
endif
if PlatformDirection = 0
SetSpritePhysicsVelocity(Platform, 30, 0)
elseif PlatformDirection = 1
SetSpritePhysicsVelocity(Platform, -30, 0)
endif
Sync()
loop