So I'm in the middle of a school project that I have to hand next month.
Anyway, I have created 3 Types- one for 3D modeling, one for the levels in the game and another one for the enemies(which are, creatively, called "Aliens")
As you can see, in m3Level there is an array of Aliens, and the aliens are build as m3Solid. (m3Location is another type which represents where the aliens will spawn)Code:Public Type m3Solid nVerts As Integer Verts() As m3Point nFaces As Integer Faces() As m3Face End Type Public Type m3Level Num As Integer noAliens As Integer AA() As m3Alien End Type Public Type m3Alien Body As m3Solid Dome As m3Solid aLoc As m3Location End Type
I have two functions that create the alien, but my problem is that when I return the alien from one function to the other, it's like it was "reseted".
Here are my two functions:
I've created two MsgBox to see what happens when the alien is being returned. In the first MsgBox the value is 40, in the second it's 0.Code:Public Function SysInit(w As Double, ByVal h As Double) As m3Alien Dim r As Double Dim s As m3Alien r = 30 s.Body = m3GetPrizm(r * 1.4, h / 5, 20) s.Dome = m3GetHalfSphere(r, 20) m3SolidApply s.Body, m3Translate(0, -h / 5, 0) MsgBox s.Body.nVerts SysInit = s End Function Public Function createAlien(ByRef loc As m3Location, ByRef obj As Object) Dim i As Integer Dim a As m3Alien For i = 1 To getCurLevel.noAliens getCurLevel.AA(i) = Alien.SysInit(30, 45) MsgBox getCurLevel.AA(i).Body.nVerts sendShips locs(getRandomInt), getCurLevel.AA(i), obj 'checkWhereAlien obj Next i setCurLevel lvls(getCurLevel.Num) End Function
I don't know what is wrong because everything seems fine to me.
By the way, I hope you can understand this without all the code. If you want I can paste here the entire code.




Reply With Quote