December 04, 2020, 11:26:23 AM

Author Topic: [bb] Dot tunnel by Bremer [ 1+ years ago ]  (Read 380 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Dot tunnel by Bremer [ 1+ years ago ]
« on: June 29, 2017, 12:28:40 AM »
Title : Dot tunnel
Author : Bremer
Posted : 1+ years ago

Description : Move your mouse around and the tunnel exit follows.

Code :
Code: BlitzBasic
  1. ;       DOT TUNNEL / made by Zawran in July 2003
  2.  
  3. Graphics 800,600,32,2
  4.  
  5. ;// SETUP VARS AND STUFF
  6.  
  7. Type ringdot
  8.         Field x         ;xpos
  9.         Field y         ;ypos
  10.         Field a         ;angel
  11.         Field s         ;speed
  12.         Field z         ;distance
  13. End Type
  14.  
  15. speed = 5
  16.  
  17. ;//
  18.  
  19. SetBuffer BackBuffer()
  20.  
  21. While Not KeyHit(1)
  22. If Timer + 1000 <= MilliSecs() Timer = MilliSecs() : FPS_Real = FPS_Temp : FPS_Temp = 0
  23. FPS_Temp = FPS_Temp + 1 : Text 0,580,"FPS: " + FPS_Real
  24.  
  25. ;       Every 100 millisecond create another dot ring
  26.  
  27. If newring + 100 <= MilliSecs() Then
  28.         newring = MilliSecs()
  29.         Gosub createRing
  30.         End If
  31.        
  32. t=0
  33.  
  34. ;       DRAW THE RINGS EVERY FRAME
  35.  
  36. rd.ringdot = Last ringdot
  37. Repeat
  38.         Color 50+rdz/2,50+rdz/2,50+rdz/2
  39.         Rect rdx+Sin(rda)*rdz,rdy+Cos(rda)*rdz,2,2
  40.         rd.ringdot = Before rd
  41.         t=t+1
  42. Until rd = Null
  43.  
  44. Color 255,255,255
  45.         Text 0,0,"# Dots: "+t
  46.                 Text 340,0,"MOVE YOUR MOUSE!"
  47.  
  48. ;       TIME UPDATE
  49.  
  50. If ringupd + 5 <= MilliSecs() Then
  51.         ringupd = MilliSecs()
  52.         For rd.ringdot = Each ringdot
  53.                 rdz = rdz + speed
  54.                 If rdz > 400 Then Delete rd
  55.         Next
  56.         End If
  57.  
  58. Flip
  59. Cls
  60. Wend
  61.  
  62. For rd.ringdot = Each ringdot
  63.         Delete rd
  64. Next
  65.  
  66. End
  67.  
  68. .createRing
  69. For a = 0 To 360 Step 5
  70.         rd.ringdot = New ringdot
  71.         rdx = MouseX()
  72.         rdy = MouseY()
  73.         rda = a
  74.         rdz = 5
  75.         rds = 2
  76. Next
  77. Return


Comments :


Doggie(Posted 1+ years ago)

 A very minor mod
Code: [Select]
; DOT TUNNEL / made by Zawran in July 2003
;minor mod by Doggie in April 2010

Graphics 800,600,32,2

;// SETUP VARS AND STUFF

Type ringdot
Field x ;xpos
Field y ;ypos
Field a ;angel
Field s ;speed
Field z ;distance
End Type

speed = 5

;//

SetBuffer BackBuffer()

While Not KeyHit(1)
If Timer + 1000 <= MilliSecs() Timer = MilliSecs() : FPS_Real = FPS_Temp : FPS_Temp = 0
FPS_Temp = FPS_Temp + 1 : Text 0,580,"FPS: " + FPS_Real

; Every 100 millisecond create another dot ring

If newring + 100 <= MilliSecs() Then
newring = MilliSecs()
Gosub createRing
End If

t=0

; DRAW THE RINGS EVERY FRAME

rd.ringdot = Last ringdot
Repeat
;Color 50+rdz/2,50+rdz/2,50+rdz/2
Color Rand(0,255),Rand(0,255),Rand(0,255)
Oval rdx+Sin(rda)*rdz,rdy+Cos(rda)*rdz,6,6
rd.ringdot = Before rd
t=t+1
Until rd = Null

Color 255,255,255
Text 0,0,"# Dots: "+t
Text 340,0,"MOVE YOUR MOUSE!"

; TIME UPDATE

If ringupd + 10 <= MilliSecs() Then;change +10 number for effect
ringupd = MilliSecs()
For rd.ringdot = Each ringdot
rdz = rdz + speed
If rdz > 240 Then Delete rd
Next
End If

Flip
Cls
Wend

For rd.ringdot = Each ringdot
Delete rd
Next

End

.createRing
For a = 0 To 360 Step 5
rd.ringdot = New ringdot
rdx = MouseX()
rdy = MouseY()
rda = a
rdz = 5
rds = 2
Next
Return


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal