this still happens and i have an idea why
SetWindowTitle("Prjkt Hook")
SetErrorMode(2)
SetVirtualResolution(320, 180)
SetWindowSize(1280, 720, 0)
SetClearColor(151, 170, 204)
SetScissor(0, 0, 0, 0)
UseNewDefaultFonts(1)
SetDisplayAspect(180/320)
SetDefaultMinFilter(0)
SetDefaultMagFilter(0)
SetPhysicsScale(0.2)
SetPhysicsGravity(0, 276)
SetSyncRate(60, 1)
SetPhysicsDebugOn()
ropeSpr as integer[]
box = CreateSprite(0)
SetSpritePhysicsOn(box, 1)
SetSpritePosition(box, 15, 15)
SetSpritePosition(box, 150, 80)
char = CreateSprite(0)
SetSpriteSize(char, 10, 20)
SetSpritePhysicsOn(char, 2)
SetSpritePhysicsCanRotate(char, 0)
SetSpritePosition(char, 50, 50)
global x = 0
global y = 0
global angle as float
global angle2 as float
do
if GetRawMouseLeftPressed()
// Get Direction
x = GetPointerX()
y = GetPointerY()
dirx = x - GetSpriteXByOffset(char)
diry = GetSpriteY(char) - y
angle = atanfull(dirx, diry)
// If there is a rope, erase it to create another
if ropeSpr.length > -1
for i = 0 to ropeSpr.length
DeleteSprite(ropeSpr[i])
next i
ropeSpr.length = -1
endif
//Make Rope with hook
for i = 0 to 30
spr = CreateSprite(0)
setspritephysicsOn(spr, 2)
SetSpritePhysicsMass(spr, 0)
SetSpriteSize(spr, 2, 1)
SetSpriteVisible(spr, 1)
dirx = x - GetSpriteXByOffset(char)
diry = GetSpriteY(char) - y
angle2 = atanfull(diry, dirx)
SetSpriteAngle(spr, angle2)
SetSpritePositionByOffset(spr, GetSpriteXByOffset(char), GetSpriteY(char))
//SetSpriteShapeCircle(spr, 0, 0, 2)
if ropeSpr.length = -1
SetSpritePositionByOffset(spr, GetSpriteXByOffset(spr) + (1*sin(angle)), GetSpriteYByOffset(spr) + (1*cos(angle)))
CreateDistanceJoint(spr, char, GetSpriteXByOffset(spr), GetSpriteYByOffset(spr), GetSpriteXByOffset(char), GetSpriteY(char), 0)
//CreateRevoluteJoint(char, spr, GetSpriteXByOffset(spr), GetSpriteYByOffset(spr), 0)
else
SetSpritePositionByOffset(spr, GetSpriteXByOffset(ropeSpr[ropeSpr.length]) + (10*sin(angle)), GetSpriteYByOffset(ropeSpr[ropeSpr.length]) + (10*cos(angle)))
j = CreateDistanceJoint(ropeSpr[ropeSpr.length], spr, GetSpriteXByOffset(ropeSpr[ropeSpr.length]), GetSpriteYByOffset(ropeSpr[ropeSpr.length]), GetSpriteXByOffset(spr), GetSpriteYByOffset(spr), 1)
//CreateWeldJoint(ropeSpr[ropeSpr.length], spr, GetSpriteXByOffset(spr), GetSpriteYByOffset(spr), 1)
//CreateRopeJoint(ropeSpr[ropeSpr.length], spr, GetSpriteXByOffset(ropeSpr[ropeSpr.length]), GetSpriteYByOffset(ropeSpr[ropeSpr.length]), GetSpriteXByOffset(spr), GetSpriteYByOffset(spr), 3, 1)
//CreateRevoluteJoint(ropeSpr[ropeSpr.length], spr, GetSpriteXByOffset(spr), GetSpriteYByOffset(spr), 1)
SetJointDamping( j, 10, 0)
endif
ropeSpr.insert(spr)
// If this finds any object that can be grabbed, grab it now
if GetSpriteCollision(ropeSpr[ropeSpr.length], box)
CreateDistanceJoint(ropeSpr[ropeSpr.length], box, GetSpriteXByOffset(ropeSpr[ropeSpr.length]), GetSpriteYByOffset(ropeSpr[ropeSpr.length]), GetSpriteXByOffset(box), GetSpriteYByOffset(box), 0)
//CreateRopeJoint(ropeSpr[ropeSpr.length], spr, GetSpriteXByOffset(ropeSpr[ropeSpr.length]), GetSpriteYByOffset(ropeSpr[ropeSpr.length]), GetSpriteXByOffset(spr), GetSpriteYByOffset(spr), 3, 1)
exit
endif
next i
endif
// Draw string
for i = 0 to ropeSpr.length - 1
c = MakeColor(255, 255, 255)
DrawLine(GetSpriteXByOffset(ropeSpr[i]), GetSpriteYByOffset(ropeSpr[i]), GetSpriteXByOffset(ropeSpr[i + 1]), GetSpriteYByOffset(ropeSpr[i + 1]), c, c)
next i
if GetRawMouseRightPressed()
if ropeSpr.length > -1
for i = 0 to ropeSpr.length
DeleteSprite(ropeSpr[i])
next i
ropeSpr.length = -1
endif
endif
//Move
if GetRawKeyState(KEY_D)
if not GetSpritePhysicsVelocityX(char) >= 75
SetSpritePhysicsVelocity(char, 70, GetSpritePhysicsVelocityY(char)) : SetSpriteFlip(char, 0, 0)
endif
elseif GetRawKeyState(KEY_A)
if not GetSpritePhysicsVelocityX(char) =< -75
SetSpritePhysicsVelocity(char, -70, GetSpritePhysicsVelocityY(char)) : SetSpriteFlip(char, 1, 0)
endif
endif
//Jump
if GetRawKeyPressed(KEY_W)
SetSpritePhysicsImpulse(char, GetSpriteXByOffset(char), GetSpriteYByOffset(char), 0, -1500)
endif
Print(ScreenFPS())
Sync()
loop
#constant KEY_D 68
#constant KEY_W 87
#constant KEY_A 65