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 / Types - is it possile to...

Author
Message
Maelstrom
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: United Kingdom
Posted: 30th Mar 2004 00:43
Hi

When using types is it possile to group them together in the same way you can with dim statments. For Example when using a dim statement you can have dim something(100,100) as integer where for each of the 1st dimension you can have 100 of the second.

Example:

This is my type statment with fields which later goes on to store the positions of 32 bomb fragments.

type explodefx
x# as float
y# as float
z# as float
obj as integer
xx# as float
yy# as float
zz# as float
Force as integer
fade# as float
endtype

dim explode(32) as explodefx


This only lets me use this on one occasion at a time. For multiple explosions i want something like

type blastset
explode (32) as explodefx
free as integer
endtype

dim blast(20) as blastset

My aim here would be that i could have up to 20 explosions going off at once then when needed cycle through the blastset(??).free to identify any free slots which could be reused.

Maybe i'm going about all this the wrong way so please set me straight. Remember i am a newbie so be kind.

Thanks
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Mar 2004 01:21
You can't have an array inside a type, but you can mimic it



*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Maelstrom
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: United Kingdom
Posted: 30th Mar 2004 02:30 Edited at: 30th Mar 2004 02:34
I see. So with the dim blast_explode(20,32) as xplodefx statement you would have 20 explodefx
fields but with 32 secondary explodefx field.

Thanks for that IanM.

Would this be the best method for multiple explosion/fragment/missile situations or would you advise an alternative??
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 30th Mar 2004 07:26
I'd have two arrays one for many small explosions (your normal swarms of enemy units and shots) and just a few for the big blasts (nukes, bosses, etc.) But, that's just my call.
--
TAZ

Maelstrom
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: United Kingdom
Posted: 30th Mar 2004 11:17
Thanks for the suggestion Zircher. I'll give it a go.
Night Giant
21
Years of Service
User Offline
Joined: 26th Jul 2003
Location:
Posted: 30th Mar 2004 11:39
if you are using dbc and darkedit, you can have arrays in a type:

type typewitharray
array(10,10)
endtype

just like that.

oh, wow. insignificantpunks.cjb.net. we like orange treble clef notes, just for future reference.

no: website for progs yet.
Maelstrom
20
Years of Service
User Offline
Joined: 24th Feb 2004
Location: United Kingdom
Posted: 30th Mar 2004 14:36
NightGiant. I should have said that i'm using DBpro, so i asume that i can only do this using IamM's suggestion. Thanks for the post though.

Login to post a reply

Server time is: 2024-09-22 03:09:01
Your offset time is: 2024-09-22 03:09:01