yes you can, and thats exactly the right way for coding less lines and making reusable code.
box 0, 0, 20, 10
Get Image 1, 0, 0, 20, 10
cls
Sprite 1, 320, 240, 1
Offset Sprite 1, 10, 5
Sprite 2, 220, 140, 1
Offset Sprite 2, 10, 5
Sync On
Do
sprFlash(1, 250, 0, 0)
sprFlash(2, 250, 100, 0)
Set Cursor 0, 0
Print "move your mouse over boxes and see each one has different diffusion"
Print "in /sprFlash/ Function i call /inSprZone/ Function which is another function"
Sync
Loop
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`n = sprite number
`r = red color
`g = green color
`b = blue color
Function sprFlash(n As Integer, r As Integer, g As Integer, b As Integer)
inZone = inSprZone(n)
If inZone = 1
Set Sprite Diffuse n, r, g, b
Else
Set Sprite Diffuse n, 255, 255, 255
EndIf
EndFunction inZone
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
`n = sprite number
Function inSprZone(n As Integer)
mx = mouseX()
my = mouseY()
x1# = Sprite X(n) - Sprite Width(n) / 2.0
x2# = Sprite X(n) + Sprite Width(n) / 2.0
y1# = Sprite Y(n) - Sprite Height(n) / 2.0
y2# = Sprite Y(n) + Sprite Height(n) / 2.0
If mx > x1# And mx < x2# And my > y1# And my < y2#
inZone = 1
Else
inZone = 0
EndIf
EndFunction inZone
`<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Too Sexy