Hello, this is my first post on this forum, so I'll just give a little intro.
I've been lurking here for a while and reading up on DarkBASIC. I have some experience with computer programming (mostly with JavaScript and Liberty BASIC, I've dabbled a bit with C++, but I couldn't figure out how to use the editor I was using, so I didn't get very far with that.
) so I'm already used to variables, loops, etc, and I've worked with 3D also (POV-RAY and CAD programs mostly), so I'm also familiar with 3D coordinates, axis rotations, etc. This is my first foray into putting the two together however, so it's pretty exciting for me.
Anyways, downloaded the trial a couple of days ago, almost finished with my very first game.
It's a simple game where you're running around a matrix, collecting blue crystals, and trying to get more than the CPU before time runs out. I've got all of the main routines done, the menu system, the game engine, the AI, etc, so I decided to start adding the bells and whistles. Right now I'm trying to add a small sparkle effect whenever you get a crystal, but I can't get the sparkle to align to the camera's position.
I did a forum search, seems other people also had this problem, but none of the suggestions offered seemed to worked for me.
Here's my code:
sync on
sync rate 40
backdrop on
color backdrop rgb(32, 32, 32)
` Load texture
remstart
load bitmap "..\CrystalCatcher\BmpSparkle.bmp", 1
set current bitmap 1
get image 1, 0, 0, 45, 45
mirror bitmap 1
get image 2, 0, 0, 45, 45
set current bitmap 0
delete bitmap 1
remend
` Make object for camera to look at
make object plain 1, 15, 15
position object 1, 0, 0, 0
rotate object 1, 0, 180, 0
fix object pivot 1
set object 1, 1, 0, 1, 1, 0, 0, 0
`texture object 1, 1
` Default camera position
camA# = 0
cX# = newxvalue(0, camA#, 30)
cY# = newyvalue(0, camA#, 30)
cZ# = newzvalue(0, camA#, 30)
position camera cX#, cY#, cZ#
point camera 0, 0, 0
do
` Update camera position
camA# = wrapvalue(camA# + 1)
cX# = newxvalue(0, camA#, 30)
cY# = newyvalue(0, camA#, 30)
cZ# = newzvalue(0, camA#, 30)
position camera cX#, cY#, cZ#
point camera 0, 0, 0
` Update object orientation
point object 1, camera position x(), camera position y(), camera position z()
sync
loop
I'm pretty much stumped. Anybody have any solutions?