I am trying to create a pulley joint but the app crashing. here is the code. (sorry it looks a bit junky)
setclearcolor (125,175,50)
setvirtualresolution(320,480)
screen_x# = getvirtualwidth()
screen_y# = getvirtualheight()
Ball1 = make_sprite("engine.png",screen_x#/2.0-100,35,175,0,175,45,1,2)
Ball2 = make_sprite("engine.png",screen_x#/2.0+100,35,175,0,175,45,1,2)
Ball3 = make_sprite("engine.png",screen_x#/2.0-100,200,175,0,0,45,1,2)
Ball4 = make_sprite("engine.png",screen_x#/2.0+100,200,0,175,175,45,1,2)
joint = createpulleyjoint(ball3,ball4,screen_x#/2.0-100,200,screen_x#/2.0+100,200,screen_x#/2.0-100,35,screen_x#/2.0+100,35,1,1)
do
pointer_x# = getpointerx()
pointer_y# = getpointery()
if getpointerpressed()
sp = getspritehit(pointer_x#, pointer_y#)
if sp>0
mousejoint = createmousejoint(sp,pointer_x#,pointer_y#,getspritephysicsmass(sp)*50000)
jointexist = 1
endif
elseif (getpointerreleased() && jointexist)
deletejoint(mousejoint)
jointexist = 0
sp=0
elseif sp>0
setjointmousetarget(mousejoint,pointer_x#,pointer_y#)
endif
Sync()
loop
end
`-------------------------------
function make_sprite(image$,x#,y#,red,green,blue,size,phyflag,physicstype)
spriteno = createsprite (loadimage(image$,0))
setspritepositionbyoffset(spriteno,x#,y#)
setspritesize(spriteno,size,size)
setspritecolor(spriteno,red,green,blue,255)
if phyflag = 1 then setspritephysicson(spriteno,physicstype)
setspritephysicsrestitution(spriteno,0)
endfunction spriteno