A Type in a Type
Blitz3D Forums/Blitz3D Programming/A Type in a Type
| ||
Is there a way to have a type in another type ex. Type ship Field mesh Field Type lights Field mesh Field x,y,z Field End Type End Type |
| ||
Not like that but you can do ... Type TypeLight field Mesh field x, y, z end type type TypeShip field mesh field Light.TypeLight end type S.ship = new TypeShip s\Light = new TypeLight s\Light\x = 10 etc.. The Lights x coord = S\Light\x |
| ||
a type is a data structuring method, so there is no need or reason to do that. it is like saying you want to put smaller apples inside apples, why? they're all apples aren't they? |
| ||
@somethingfunky ... I use this type of thing all the time so I've no idea what your on about! A better example is using a Vector type ... Type Vector field x#,y#,z# end type type Ship field Velocity.vector field Acceleration.vector end type type Otherthing field Position.vector end type This is far more elegant than storing x,y,z as a field in each type which uses coords. Stevie |
| ||
@Somethingfunky... i think that they want to put melons inside apples, hehehe |
| ||
i think i meant that there is no need to do this kind of thing. Type outer field o_name Type inner field i_name end Type end Type |
| ||
what if you have: Type outer field o_name field inner.inner[99] End Type Type inner field i_name End Type |
| ||
don't know... an error? i'm still learning how to use types in Blitz. |
| ||
I use it for characters Monster\Bullets The monster can shoot multiple bullets and you know which bullet is associated with which monster. You can create and delete bullets as needed |
| ||
Sorry, I know this is offtopic, but I've got a question for Ice9 and he doesn't have an email-address in his profile... Ice, do you happen to be a fan of Joe Satriani? He has a song called "Ice Nine". Or is it just coincidence? :) |
| ||
Ah I like Joe Satriani, he's a skilled technician at his craft but doesn't have a wide range of emotion but all in all great to listen to. Joe probably got the name from the same place I did.... http://www.amazon.com/exec/obidos/tg/detail/-/038533348X/qid=1122423648/sr=8-1/ref=pd_bbs_sbs_1/104-7765726-4697536?v=glance&s=books&n=507846 |