Morning all. The following piece of code has 2 problems but I'm damned if I can work out why. The code sets up 2 static sprites with physics. The sprite on the left is just a standard box 96 pixels by 96 pixels. The sprite on the right; I've tried to define a small box on the right hand side of the sprite 96 pixels high and 18 pixels wide.
Problem 1 is that neither of the sprites display - well I should say they appear then disappear very quickly. If I create the first sprite by loading an image, then both sprites appear correctly (but problem 2 still exists).
Problem 2 is that the sprite on the right's physics shape isn't where I expect it to be, it's to the left and up of where I thought I'd told it to be.
SetVirtualResolution( 800, 600 )
SetPhysicsDebugOn()
CreateSprite(1, 0) //LoadImage("hpipe.png"))
CreateSprite(2, 0)
// Left Sprite
SetSpriteSize(1, 96, 96)
SetSpriteOffset(1, 48, 48)
SetSpriteColor(2, 100,0,100,255)
SetSpritePositionByOffset(1, 200, 300)
SetSpriteShape(1, 2)
SetSpritePhysicsOn(1, 1)
// Right Sprite
SetSpriteSize(2, 96, 96)
SetSpriteOffset(2, 48, 48)
SetSpriteColor(2, 100,100,0,255)
SetSpritePositionByOffset(2, 500, 300)
SetSpritePhysicsOn(2, 1)
SetSpriteShapeBox(2, -48, -48, -30, 48, 0)
do
Sync()
loop
Can anyone tell me what I'm doing wrong?
"Happiness is contrary to the human condition" --White (to Black)