Skip to content

Instantly share code, notes, and snippets.

@Tricky1975
Created March 15, 2020 13:08
Show Gist options
  • Save Tricky1975/6b6bb3b2706978b5d98edf186c75518e to your computer and use it in GitHub Desktop.
Save Tricky1975/6b6bb3b2706978b5d98edf186c75518e to your computer and use it in GitHub Desktop.
Some short 1-sourcefile programs used during the development of Dyrt.NET
; This is a little bit of BlitzBasic code, I used to quickly
; create the targets Aziella can shoot with her crossbow in
; order to solve puzzles.
;
; In the end I used BlitzPlus to run the program (it should
; also work in Blitz3D, but for some odd reason the second
; flip command is systematically ignored by Blitz3D)
;
; I used this program also to create a bit of lighting effect
; in the target.
;
; If you have a use for this program (even when only as a template)
; use it the way you see fit. Credit for me is appreciated, but
; not required (as long as you don't claim it as your own), and of
; course I cannot be held liable for any damages (of which I cannot
; imagine how they are possible) if if I am aware of the possibilities
; of such damages.
AppTitle "SchiefSchijf"
Graphics 640,480
Function Min(a,b)
If a<b Then Return a Else Return b
End Function
Function Max(a,b)
If a>b Then Return a Else Return b
End Function
Function GC(rad,r,g,b)
Local disx
Local disy
Local hypothenusa
Local m#=2.1
For ax = 0 To 32
For ay=0 To 32
disx = Abs(16-ax)
disy = Abs(16-ay)
hypothenusa = Floor( Sqr( (disx^2) + (disy^2) ) )
If hypothenusa<=rad
;Color r/((ax+ay)/1.1),g/((ax+ay)/1.1),b/((ax+ay)/1.1)
Color max(0,r-((ax+ay)*m)),max(0,g-((ax+ay)*m)),max(0,b-((ax+ay)*m))
Plot ax,ay
End If
Next
Next
End Function
Cls
For i=0 To 4
Color 255-(i*10),180-(i*25),0
Line 14+i,16,14+i,64
Next
GC 16, 0, 0,255
gc 12,255,255,255
gc 8,255, 0, 0
gc 4,255,255, 0
Flip
Repeat
Until WaitKey()=13
Cls
For i=0 To 4
Color 255-(i*10),180-(i*35),0
Line 14+i,16,14+i,64
Next
gc 16,180,255,0
Flip
Repeat
Until WaitKey()=27
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment