This is what I would do with your code :
1) Get used to using Superstrict it makes you define each variable. At first this is a pain but solves problems before they happen.
2) Move you Dude list into the Due type. It is more self-contained that way.
3) Have a Dude update function so you don't need to loop a list in the mainloop.
4) Have your create loop handle the number to create rather than your main code.
1) Get used to using Superstrict it makes you define each variable. At first this is a pain but solves problems before they happen.
2) Move you Dude list into the Due type. It is more self-contained that way.
3) Have a Dude update function so you don't need to loop a list in the mainloop.
4) Have your create loop handle the number to create rather than your main code.
'FIRST ATTEMPT AT BASIC OOP SuperStrict Graphics 1280, 1024 SeedRnd(MilliSecs()) AutoMidHandle 1 Type dude Global List:TList = New TList Field x:Int, y:Int, rot:Int Function update() For Local all:dude=EachIn list all.update_each Next End Function Method New() x = Rnd(0, 1280) y = Rnd(0, 1024) rot = Rnd(0, 360) List.AddLast(Self) End Method Method draw() SetRotation(rot) DrawRect(x, y, 15, 15) End Method Method update_each() If KeyDown(KEY_LEFT) Then rot:-1 If KeyDown(KEY_RIGHT) Then rot:+1 Self.draw() End Method Function Create:dude(num_to_create:Int) For Local x:Int= 0 To num_to_create-1 Local temp:dude = New dude Next End Function End Type dude.Create(100) While Not KeyHit(KEY_ESCAPE) Cls dude.update() Flip Wend End