creating types/objects in a separate file?

BlitzMax Forums/BlitzMax Beginners Area/creating types/objects in a separate file?

kaiserpc(Posted 2008) [#1]
Hi,

I'm creating quite a few Types for a game and I want to include in them in a separate file to my main .bmx file. Is it easy to do this? And then how do you reference them in your main .bmx program


LarsG(Posted 2008) [#2]
just Include or Import the type file(s) in your main .bmx file..

You should be able to reference them exactly as you would if they were in the main .bmx file..


Htbaa(Posted 2008) [#3]
If possible try to Import them. That way all files will be compiled separately which speeds up building time when only editing a few files. Be sure to enable Quick Build though.


kaiserpc(Posted 2008) [#4]
okay thanks for that. I'm assuming the syntax is something like;

import shipclass.bmx 'where shipclass.bmx is in the same dir

'and then to declare & reference

global playership:ship=ship.create()
playership.moves=10
playership.x=20
playership.y=50