Is this possible? I've got a starfield created of an array of the type "star" working fine, but it forces me to run a for-next loop in my main-code both when moving and drawing the stars.
Would it be possible to turn things around by having the array and loops running inside the type? Something like this:
This is somewhat simplified and cleaned up from my actual code, which contains Norwegian varaiable-names so a few typos might have snuck in...
Would it be possible to turn things around by having the array and loops running inside the type? Something like this:
Type tstar Field x : Float [] Field y : Float [] Field xspeed : Float [] Field stars : Int ' number of stars Method draw() For counter =0 To stars-1 Plot x[counter],y[counter] Next'counter End Method'draw Method move() For counter = 0 To stars-1 x[counter] = x[xcounter] - xspeed[counter] If x[counter]<=0 Then x[counter] = 1024 Next'counter End Method'move Method New For counter = 0 To stars-1 x[counter] = Rand (-1, 1024) y[counter] = Rand (-1, 768) xspeed[counter] = rand (1, 4 ) Next'counter End Method'new End Type'Tstjerne
This is somewhat simplified and cleaned up from my actual code, which contains Norwegian varaiable-names so a few typos might have snuck in...