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 / Starfield using types not working :(

Author
Message
Steve Fash
22
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 27th Apr 2003 12:47
Ok, it's one of my first DB proggies, but i'm only getting one star instead of 200
Anyone know why ?
I wrote a similar program in blitz and it worked fine....
Cheers
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Apr 2003 13:30
That won't work, even using <spit> blitz

Here's a version I've modified to do what you want:

Steve Fash
22
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 27th Apr 2003 13:34
no I know that wouldn't work in blitz..I left out the stars.stars=new stars blitz part cos it wasn't relevant to my db request...
Thanks for the reply tho m8, much appreciated

Steve Fash
22
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 27th Apr 2003 13:40
Sorry mate, but using your code snippet under darkedit (with dbclassic and enhancements) I'm getting syntax error.Unknown command at line 5.....
I copied and pasted the code straight from you snippet.....


IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Apr 2003 13:59
I assumed from your code that you were using DBPro. Anyway, here's the classic version.


The differences:
No global variables, except that arrays are always global (maxstars)
No types, so use an individual array for each field (starsx,starsy)
Steve Fash
22
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 27th Apr 2003 14:16 Edited at: 27th Apr 2003 14:24
Hope you don't think I'm being a pain (I bet you do now!) , but using darkedit I've been able to do globals and types...I thought using that instead of the usual dbgui would make it closer to blitz and easier for me to convert over as I've found many db commands a lot easier than blitz...
Is there any chance of a dbclassic for darkedit version with types, or is that just TOO cheeky ? (if you don't ask you don't get LOL)
Cheers


For game/demo music for YOUR PC and GP32 productions visit:-www.futuredevelopments.org.uk
Steve Fash
22
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 27th Apr 2003 14:23
The version I wrote on blitz is this :-
And apart from the buffer locking etc I want to transfer it to db..

Const starno=1000
;----
Type stars
Field x,y,speed,depth
End Type
;----
Graphics 640,480,16
SetBuffer BackBuffer()
plotstars
While Not KeyHit (1)
updatestars
UnlockBuffer
Flip:Cls
Wend
End
;----
Function plotstars()
For sn=0 To starno
stars.stars=New stars
stars\speed=Rnd(1,8)
stars\depth=Rnd(180,255)
stars\x=Rnd(-10,650)
stars\y=Rnd(-10,490)
Next
End Function
;----
Function updatestars()
For stars.stars=Each stars
Color stars\depth,200,200
Rect stars\x,stars\y,2,2,1
stars\x=stars\x-stars\speed
If stars\x<0 Then stars\x=641
Next
End Function
;----

Hope that gives you an idea of what I'm trying to achieve Ian

For game/demo music for YOUR PC and GP32 productions visit:-www.futuredevelopments.org.uk
EdzUp
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: UK
Posted: 27th Apr 2003 14:41 Edited at: 27th Apr 2003 14:45
Your best bet here is to use an array for space particles, the reason I say this is array are MUCH easier to manage and are faster to go through.

SF2000 uses a rough space particle system you can get a download of the source from www.edzup.co.uk this works with DB1.13 and DarkEdit. If you have any questions I will try to answer them

-EdzUp
Steve Fash
22
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Doncaster, UK
Posted: 27th Apr 2003 15:07
Hi Ed-I 4got you coded in DB before BB
I'll drop u a line seeing as we've worked together before on Hunted...
Latest version was even better btw-I had no probs on my system too

For game/demo music for YOUR PC and GP32 productions visit:-www.futuredevelopments.org.uk
EdzUp
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: UK
Posted: 27th Apr 2003 23:26
There are somethings in DB that I wish were in Blitz and there are somethings that are in Blitz that I would love to be in DB/DBPro, I use the best system IMHO for the job at hand .

-EdzUp
EdzUp
22
Years of Service
User Offline
Joined: 8th Sep 2002
Location: UK
Posted: 28th Apr 2003 22:31 Edited at: 28th Apr 2003 22:32
Here is my take on the starfield thing , on my machine I get 25-35fps in DB1.13 and 21fps in DBPro . Hope its of use to someone

Source button at bottom of this message has source in it

-EdzUp
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Apr 2003 23:31
I know about the 'types' in DarkEDIT, they basically do a textual substitution on the source before passing it to the compiler.

But the problem is that sometimes the preprocessing misses stuff - just make sure you put spaces around your types when you use them, and you should be OK.

Also, not everyone uses them anyway.

Login to post a reply

Server time is: 2025-05-18 21:40:29
Your offset time is: 2025-05-18 21:40:29