Feedback wanted on code style

BlitzMax Forums/BlitzMax Beginners Area/Feedback wanted on code style

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

What Otus said!
Just imagine you need later a split screen, a canvas, or a window inside the window... no need to write another type with different settings. You could use a parameter in a create function to be fully flexible:
Type TStarField
	Field Width:int
	Field Height:int
	...

	Function Create:TStarField( Width:int, Height:int )
		Local StarField:TstarField = New TStarField
		StarField.Width = Width	'optional width-1 and save all -1 in the code... 
		StarField.Height = Height
		Return StarField
	End Function
...
End Type


Consider a situation where two keys are down. The ElseIf version only registers the first one, whereas the multi-If-version registers both.


Exactly, and that's what I meant with the diagonal move, where you need to press two buttons simultaneously. Your optional if statement would not allow that. Don't know if its important for your game though.