Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Is there a better way of doing this?

Author
Message
Retro Addict
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location: Georgia, USA
Posted: 13th Aug 2004 03:20
I'm working on my game, Rebel's Run. In my ever constant attempt to streamline my code as much as possible, I ask this: The first level has asteroids rotating as they decend down on you. Surely there has to be a more efficient way of doing this than the way I am. I'm not losing any framerate (surprisingly, since I have 4 different sets of asteroids that I use this routine on, so I have this bit of code for each set), but I want to make my code as tight as possible. I've attached the code below, can someone take a look at it and suggest a more efficient and possibly less lines of code to do the same thing? I'm rotating in 5 degree increments. Anything higher and the asteroids don't rotate smoothly. I'd really like to use 1 degree increments for extreme smoothness, but with the way I do it now, I'd have a million lines of code just to rotate 4 sets of asteroids (about 366 lines for each set). This of course is all done within the do/loop sequence. Thanks in advance...

PC Specs: AMD 1800+ 512M DDR, Radeon 128meg DDR - DB v1.13

To DB or not to DB............duh DB!
Damokles
21
Years of Service
User Offline
Joined: 28th May 2003
Location: Belgium
Posted: 13th Aug 2004 03:51
try simply :

IF rotate=71 then rotate =1

IF rotate > 0 AND rotate < 71
xrotate object i, rotate * 5
ENDIF


- Mind the gap -
mr joe
20
Years of Service
User Offline
Joined: 12th Aug 2004
Location: Edinburger, Scotland. DBC
Posted: 13th Aug 2004 03:55
I may be wrong, im not too experienced, but could you just use another "for x=" command, eg...
Retro Addict
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location: Georgia, USA
Posted: 13th Aug 2004 04:52 Edited at: 13th Aug 2004 06:02
@ Damokles - That did it. Thanks a heap! To think I used a similar technique in an old GWBASIC game (not rotating objects mind you). I feel like such an idiot. Maybe I should go back to GWBASIC and the ASCII character set. If only I could find an old ibm xt to run it on....ahh the days of 4.77mhz and green screens....

@ mr joe - I didn't try yours as Damokles did the trick. I'm not sure if it would work or not. Thanks for the input though!

PC Specs: AMD 1800+ 512M DDR, Radeon 128meg DDR - DB v1.13

To DB or not to DB............duh DB!
Retro Addict
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location: Georgia, USA
Posted: 13th Aug 2004 05:28
Damokles, that reduced the size of my file 10.9k! I think I can apply the same principle to my explosion display routines. Thanks again!

PC Specs: AMD 1800+ 512M DDR, Radeon 128meg DDR - DB v1.13

To DB or not to DB............duh DB!
ArcAngel
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 14th Aug 2004 12:36
geez, thats alot.

"There's a glitch in the Matrix"
"Attack life, your going to die anyway."
"Visit my website! www.freewebs.com/stradigos"
Retro Addict
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location: Georgia, USA
Posted: 14th Aug 2004 23:11
yeah, the way I was doing the routine was horrible. It did *work*, but I knew there was a better way. I had 4 routines for each "set" of asteroids and the code was larger for that then it was for the rest of the entire game.

PC Specs: AMD 1800+ 512M DDR, Radeon 128meg DDR - DB v1.13

To DB or not to DB............duh DB!

Login to post a reply

Server time is: 2025-05-25 12:57:34
Your offset time is: 2025-05-25 12:57:34