Imitate Procedures/Methods in Blitz

Blitz3D Forums/Blitz3D Beginners Area/Imitate Procedures/Methods in Blitz

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.

Just break your procedure down into its smallest components and create a function for each component.

Here is an example...


Procedure Point_Relative(x,y,OffsetX,OffsetY)
; Returns New coordinates for a point on the screen
; relative to X & Y
NewX=x+OffsetX
NewY=y+OffsetY
Return NewX,NewY
End Proc

You obviously cannot do the above in Blitz so split it into its smallest components which is 2 because we want 2 new values. If you wanted 3 new values you would have to create 3 functions. Example below....

Function Point_RelativeX(x,OffsetX)
NewX=x+OffsetX
Return NewX
End Function

Function Point_RelativeY(y,OffsetY)
NewY=y+OffsetY
Return NewY
End Function

Then all you do is call both functions to get both values.
i.e.

X=Point_RelativeX(GraphicsWidth(),10)
Y=Point_RelativeY(GraphicsHeight(),10)
Text X,Y,"Hello their dude!"

The above will display 'Hello their dude!' in the centre of the current screen just slightly 10 pixels right and 10 below the absolute centre.

Hope that helps!

Regards