09-17-2004, 09:11 AM
Today, I started messing around with a program that I shelved a while back. It's a pool game...billiards...or whatever...snooker??
Anyway, I used Lightwave to render 100 sprites as a type of 10x10 matrix. The heading rotates from 0 to 324 from frames 1 to 10...11 to 20...21 to 30...so on...
The pitch rotates from 0 to 324 from frames 1 to 100, at stepped increments of 36 degrees, every 10 frames.
I saved them in ascending order like this...ball000.bmp,ball001.bmp...so on...
Then, I loaded them into an EMS array, in the exact same order.
This code is just a test until I can get the rotation to work right. It does work right if you are only rotating one direction at a time... like If the angle is 0, 90, 180, 270 or 360. When you try to rotate at any other angle, the sprites are all mixed up and it's definetly wrong.
I would post al link to the whole program, but I haven't converted the sprites to 256 colors yet and the filesize would be too much to bother with.
Thanx for any help.
Anyway, I used Lightwave to render 100 sprites as a type of 10x10 matrix. The heading rotates from 0 to 324 from frames 1 to 10...11 to 20...21 to 30...so on...
The pitch rotates from 0 to 324 from frames 1 to 100, at stepped increments of 36 degrees, every 10 frames.
I saved them in ascending order like this...ball000.bmp,ball001.bmp...so on...
Then, I loaded them into an EMS array, in the exact same order.
This code is just a test until I can get the rotation to work right. It does work right if you are only rotating one direction at a time... like If the angle is 0, 90, 180, 270 or 360. When you try to rotate at any other angle, the sprites are all mixed up and it's definetly wrong.
I would post al link to the whole program, but I haven't converted the sprites to 256 colors yet and the filesize would be too much to bother with.
Code:
Blx! = Blx! + Spd! * Tri(Ang).Sine
Bly! = Bly! + Spd! * Tri(Ang).Cine
IF Blx! < 0 THEN
Blx! = 0
Ang = 0 - Ang
END IF
IF Blx! > 607 THEN
Blx! = 607
Ang = 0 - Ang
END IF
IF Bly! < 0 THEN
Bly! = 0
Ang = 180 - Ang
END IF
IF Bly! > 447 THEN
Bly! = 447
Ang = 180 - Ang
END IF
IF Ang > 360 THEN Ang = Ang - 360
IF Ang < 0 THEN Ang = Ang + 360
PicX! = PicX! - (Spd! / 10) * Tri(Ang).Sine
IF PicX! > 9 THEN PicX! = PicX! - 9
IF PicX! < 0 THEN PicX! = 9 + PicX!
PicY! = PicY! - (Spd! / 10) * Tri(Ang).Cine
IF PicY! > 9 THEN PicY! = PicY! - 9
IF PicY! < 0 THEN PicY! = 9 + PicY!
PicNum = INT(PicX!) + (INT(PicY!) * 10)
XMSOffset& = PicNum * SpriteSize
MoveFromXMS BallPage(1), VARSEG(BallSprite(0)), VARPTR(BallSprite(0)), SpriteSize, XMSOffset&
Future.ROTATEB INT(Blx!), INT(Bly!), 0, 1, BallSprite()
Thanx for any help.