what I believe you mean is this:
1) you have a platform that moves from side to side of a room. when it hits a wall, it reverses direction.
2) a player does some action, and that action reverses the direction of the platform at that instant.
If that's the case, here's what you do:
1) store the direction the platform is moving in a global variable (or in a global array if you have lots of platforms).
2) check OBJECT COLLISION(PlatformNumber,0) each frame. if the number that is returned from OBJECT COLLISION is not the object number of your character, then it has hit something else (i.e., the wall). reverse the direction it is moving.
3) if the player does whatever it is that s/he is supposed to do, toggle the direction as well.
A really simple technique to do this would be to write a function called TogglePlatformDirection(PlatformNumber) and call it each time you want to switch directions.
(in the sample below, you'll need to figure out what TheCurrentPlatformThePlayerIsOn is equal to. i don't know how you're keeping track of this, but i assume you know where the player is...)
GLOBAL DIM PlatformDirections(10) as integer
for i = 1 to 10:PlatformDirections(10) = 1:next i
[...]
game code
[...]
if spacekey() = 1 then TogglePlatformDirection(TheCurrentPlatformThePlayerIsOn)
end
function CheckPlatformCollisions()
for i = 1 to 10
if object collision(i, 0) <> PlayerObjectNumber
TogglePlatformDirection(i)
endif
next i
endfunction
function TogglePlatformDirection(PlatformNumber)
PlatformDirections(PlatformNumber) = PlatformDirections(PlatformNumber) * -1
endfunction
hope that helps.
cheers.
-= i only do what my rice krispies tell me to do =-