Hello, I'm trying to work out a way of stopping a sprite after velocity has been applied (as if its hit a wall). I have tried many things like applying the same force in the opposite direction, turning off the physics etc, all to no avail... I need to set this sprite as kinematic so cannot simply use SetPhysicsWall (I will have other physic enabled sprites) which the wall cannot be there for...
Does anyone have any suggestions?
Here is what I have at the moment, and if you hold the left arrow key, the sprite 'bounces' off the left edge. What I want is for it to stop dead(as if there is a wall there).
SetVirtualResolution(480, 320)
SetSyncRate(60, 1)
SetClearColor(0, 0, 0)
global ForceX as integer
global TiltX as float
global Object1 as integer
global Object1X as float = 200.00
global Object1Y as integer = 134
Object1 = CreateSprite(Object1)
SetSpriteSize(Object1, 40, 60)
SetSpriteColor(Object1, 255, 0, 0, 255)
SetSpritePosition(Object1, Object1X, Object1Y)
SetSpritePhysicsOn(Object1, 3)
do
TiltX = GetDirectionX()
ForceX = TiltX * 500
if GetSpriteX(Object1) < 0
ForceX = 0
SetSpritePosition(Object1, 0, 134)
endif
SetSpritePhysicsVelocity(Object1, ForceX, 0)
Sync()
loop
Thank you!!