Types
BlitzPlus Forums/BlitzPlus Programming/Types
| ||
I have a little problem with types, there is no problem with creating them but how to place each of the same type into specified areas. I need this so the player cant walk into any objects. And I have seen the tutorial. Thanks for any help =) |
| ||
Can you supply some example code to show what you are trying to do, or give a more detailed example? TYPE works a bit differently in Blitz than in some other languages (you cannot DIM a table or array of TYPE here), but it is still basically a template to show the layout involved with an object and where different FIELD elements are placed. When you want to move data from one object to another, you basically need to refer to the active object\field name in each to make the transistion. Your coordinates for your object define where it is on the screen, and can be used to help determine if two objects are attempting to reside in the same space. But Blitz provides tools, such as collision detection, to find when and where objects meet each other as well. |
| ||
(you cannot DIM a table or array of TYPE here) Why not??? Type TExample Field value End Type Dim array.TExample(10) array(1)=New TExample array(1)\value=10 Print array(1)\value |
| ||
Sorry bothering you i found a solution thanks anyway |
| ||
I appreciate the information and example provided concerning using TYPES with ARRAYS. It was not apparent, and my efforts along that line resulted in errors that inclined me to believe it could not be done. So I stand corrected, and appreciate your taking the time to provide a working example. I anticipated the use of array(n)\fieldname, but failed to find any clue as to how to dimension it (some other BASICs would do a DIM array(10) as TExample). Unfortunately, the Command References do a minimialistic job when it comes to desrcribing how some statements might be used, and the examples offered tend to be rudimentary. Mapping fields into arrays using TYPE is a very powerful feature, so I am very glad to see that it is possible. |