15 more minutes and here is a full framework...
Again I stress, I just kept experimenting with different values until it worked how I wanted it...
setwindowsize(1024,768,0)
SetVirtualResolution(1024,768)
SetClearColor(212,212,255)
//Constants
#constant cSPACE=150
#constant cPILLARWIDTH=30
//Create Bird
c1 = MakeColor(0,0,255)
c2 = MakeColor(0,255,0)
sync()
DrawEllipse(25,15,20,15,c1,c2,1)
drawline(0,15,50,15,c1,c1)
render()
img=GetImage(0,0,50,30)
spr = CreateSprite(img)
setspritesize(spr,50,30)
ClearScreen()
dim arrSprite[100,2] as integer
SetPhysicsScale(0.01)
//SetPhysicsDebugOn()
//make the pillars
posX# = GetVirtualWidth() * 0.75
for n = 1 to 100
//pick the space
myspace = random(getvirtualheight() * 0.25, GetVirtualHeight() * 0.75)
for x = 1 to 2
arrSprite[n,x] = createsprite(0)
setspritesize(arrSprite[n,x], cPILLARWIDTH, GetVirtualHeight() * 0.75)
next x
SetSpriteColor(arrSprite[n,1],random(1,128),128 + random(1,128),128 + random(1,128),255)
SetSpriteColor(arrSprite[n,2],128 + random(1,128),128 + random(1,128),128 + random(1,128),255)
setspriteoffset(arrSprite[n,1],cPILLARWIDTH / 2, GetSpriteHeight(arrSprite[n,1]))
setspriteoffset(arrSprite[n,2],cPILLARWIDTH / 2, 0)
SetSpritePositionByOffset(arrSprite[n,1],posX#, mySpace - (cSPACE / 2))
SetSpritePositionByOffset(arrSprite[n,2],posX#, mySpace + (cSPACE / 2))
posX# = posX# + random(200,300)
SetSpriteShape(arrSprite[n,1],2)
SetSpritePhysicsOn(arrSprite[n,1],1)
SetSpriteShape(arrSprite[n,2],2)
SetSpritePhysicsOn(arrSprite[n,2],1)
next n
//spr = createSprite(0)
setspritesize(spr,30,30)
SetSpritePhysicsCanRotate(spr,0)
SetSpritePositionByOffset(spr,GetVirtualWidth() / 2, GetVirtualHeight()/3)
SetSpritePhysicsOn(spr,2)
SetSpritePhysicsMass(spr,GetSpritePhysicsMass(spr) * 100)
do
//Check for collision. Not doing anything efficient, just checking all...
for n = 1 to 100
if GetPhysicsCollision(spr, arrSprite[n,1]) = 1 or GetPhysicsCollision(spr, arrSprite[n,2]) = 1
message("BANG!")
SetSpritePhysicsOff(spr)
SetSpritePositionByOffset(spr,GetVirtualWidth() * 0.25, GetVirtualHeight() *0.25)
SetSpritePhysicsOn(spr,2)
endif
next n
if GetRawKeyPressed(32) = 1
SetSpritePhysicsVelocity(spr,GetSpritePhysicsVelocityX(spr),0)
SetSpritePhysicsImpulse(spr,GetSpriteXByOffset(spr), GetSpriteYByOffset(spr),0,-9000)
endif
if GetSpritePhysicsVelocityY(spr) < 0
SetSpritePhysicsDamping(spr,10)
else
SetSpritePhysicsDamping(spr,0)
endif
SetSpritePhysicsVelocity(spr,150,GetSpritePhysicsVelocityY(spr) * 1)
SetSpriteAngle(spr, GetSpritePhysicsVelocityY(spr) * 0.1)
SetViewOffset(0 - (GetVirtualWidth() / 2 - GetSpriteXByOffset(spr)), 0)
StepPhysics(GetFrameTime())
sync()
loop