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.

Newcomers DBPro Corner / proofread me

Author
Message
Vesper103
16
Years of Service
User Offline
Joined: 21st Feb 2008
Location: Beloit WI
Posted: 29th Feb 2008 23:06 Edited at: 29th Feb 2008 23:07
could anyone look through this and see if im using any bad coding practices or anything? im still very noobish and wanna make sure im doing okay...

(this code compiles and runs fine, i just wanna know if im doing it in a way that makes it fast)



edit: Forgot to say this is for a side/scrolling shooter


Lazlazlaz 1
19
Years of Service
User Offline
Joined: 18th Sep 2005
Location: England
Posted: 1st Mar 2008 03:23 Edited at: 1st Mar 2008 03:24
Personally I never use subroutines (gosubs), only functions.

edit: oh also, for single line comments you can use REM or ` instead of REMSTART and REMEND

As with most people I jump around which projects I work on and which I drop for a while.
Currently I'm back working on Sioux, a Hollywood Western RTS.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 1st Mar 2008 04:26 Edited at: 1st Mar 2008 04:28
Nothing you've done looks like it could be optimized for speed much, so good work on that!

A couple of things I would point out if I was forced to nitpick:

The (backslash) is used in file paths - not the / (forward slash) which is only used in URL's. DBPro doesn't seem to mind though...

Rems on the end of lines should be preceded by a : (colon) as technically it's then a multi-statement line. DBPro doesn't seem to mind though...



Could be put as:



..but that's only to save you a couple of extra lines of typing and isn't that important here. Add a few more sprites and it becomes more worthwhile.

For the same reason to a lesser extent:

ky=ky-incriment

could be written as:

Inc ky,incriment

Personally I wouldn't bother checking that the opposite cursor key isn't being pressed with an If..Then condition. It complicates the logic. For example:



gosub _hide_k is in all three sections, so it doesn't matter what keys are pressed. So, this can be outside the If..Then completely.

You only really need to increment ky and set the sprite number inside the If..Then.



Hardly any faster, but a very slight improvement. The same can be done with the Left/Right key checks.

But, on the whole no major problems.

TDK_Man

Vesper103
16
Years of Service
User Offline
Joined: 21st Feb 2008
Location: Beloit WI
Posted: 1st Mar 2008 04:33
wow awesome good to hear :


Login to post a reply

Server time is: 2024-09-27 12:18:37
Your offset time is: 2024-09-27 12:18:37