OK this is probably a dumb question but, I wanted to wrap TSound by adding some extra useful functions and properties to it, but I still wanted my new type to work exactly the same, and with the same functions as TSound (e.g. PlaySound etc) - so I started with this:
This line "test = LoadSound(ThePath$, Loopflag)" produces the following compile error: "unable to convert from Tsound to ccSound".
Actually originally I didn't have "test", I just put "self = LoadSound(ThePath$, Loopflag)" but this generates the following compile error: "expression must be a variable".
Well I understand that TSound and my ccSound are not the same, but I thought that as ccSound is inherited from TSound, self would be OK, but it isn't. I guess that all the sound functions would also fail with ccSound passed in as well as it isn't able to typecast ccSound as TSound, am I right?
Is the way to solve this to craply have a Field within the ccSound type called TheSound:TSound, and assign my LoadSound to that and then whenever I call any sound functions do it like this:
Thanks in advance, hope this makes sense!
Type ccSound Extends TSound Field test:ccSound Method LoadSample:ccSound(ThePath$, LoopFlag%) test = LoadSound(ThePath$, Loopflag) If Not Self Then ccRunTimeError ("Error loading sample "+ThePath$) End Else Return Self EndIf EndMethod EndType
This line "test = LoadSound(ThePath$, Loopflag)" produces the following compile error: "unable to convert from Tsound to ccSound".
Actually originally I didn't have "test", I just put "self = LoadSound(ThePath$, Loopflag)" but this generates the following compile error: "expression must be a variable".
Well I understand that TSound and my ccSound are not the same, but I thought that as ccSound is inherited from TSound, self would be OK, but it isn't. I guess that all the sound functions would also fail with ccSound passed in as well as it isn't able to typecast ccSound as TSound, am I right?
Is the way to solve this to craply have a Field within the ccSound type called TheSound:TSound, and assign my LoadSound to that and then whenever I call any sound functions do it like this:
MySound:ccSound 'pretend I've loaded now PlaySound(MySound.TheSound)
Thanks in advance, hope this makes sense!