Author Topic: BlitzMax : Sinewaves[BMAX]  (Read 5159 times)

0 Members and 1 Guest are viewing this topic.

Offline Dad1916

  • Atari ST
  • ***
  • Posts: 112
  • Karma: 3
    • View Profile
BlitzMax : Sinewaves[BMAX]
« on: July 12, 2006 »
not sure who wrote this, picked it up on the BlitzMax forums.  O0
Code: [Select]
Graphics 800,600,32,0
SeedRnd MilliSecs()

'Variable setup
lineAngle1 = Rnd( 359 )
lineAngle2 = Rnd( 359 )
lineAngle3 = Rnd( 359 )
lineAngle4 = Rnd( 359 )
lineAngle1add = Rnd( 1, 3 )
lineAngle2add = Rnd( 1, 3 )
lineAngle3add = Rnd( 1, 3 )
lineAngle4add = Rnd( 1, 3 )
lineColor1 = 255
lineColor2 = 255
lineColor3 = 255
numberOfLines = 128
lineSpace = 2
angleChangeRate = 15
angleUpdateRate = 250
colorUpdateRate = 5000

'SetBuffer BackBuffer()
While Not KeyHit(key_escape)

Cls

' copy current angles
angle1tmp = lineAngle1
angle2tmp = lineAngle2
angle3tmp = lineAngle3
angle4tmp = lineAngle4

' set current line color
SetColor lineColor1, lineColor2, lineColor3
' loop through the number of lines
For i = 1 To numberOfLines
' find the two End points
x1 = 320 + Sin( angle1tmp ) * 199
x2 = 320 + Sin( angle2tmp ) * 199
y1 = 240 + Sin( angle3tmp ) * 199
y2 = 240 + Sin( angle4tmp ) * 199
' draw the line
DrawLine x1, y1, x2, y2
' add the Step in angle
angle1tmp = angle1tmp + lineSpace
angle2tmp = angle2tmp + lineSpace
angle3tmp = angle3tmp + lineSpace
angle4tmp = angle4tmp + lineSpace
Next

' check If its time To advance the angles
If (MilliSecs() > lastAngleChange + angleChangeRate)
lastAngleChange = MilliSecs()
lineAngle1 = lineAngle1 + lineAngle1add ; If lineAngle1 > 359 Then lineAngle1 = lineAngle1 - 360
lineAngle2 = lineAngle2 + lineAngle2add ; If lineAngle2 > 359 Then lineAngle2 = lineAngle2 - 360
lineAngle3 = lineAngle3 + lineAngle3add ; If lineAngle3 > 359 Then lineAngle3 = lineAngle3 - 360
lineAngle4 = lineAngle4 + lineAngle4add ; If lineAngle4 > 359 Then lineAngle4 = lineAngle4 - 360
End If

' check If its time To change the angle add values
If MilliSecs() > lastAngleUpdate + angleUpdateRate
lastAngleUpdate = MilliSecs()
r = Rnd( 3 )
If r = 0 Then lineAngle1add = Rnd( 1, 4 )
If r = 1 Then lineAngle2add = Rnd( 1, 4 )
If r = 2 Then lineAngle3add = Rnd( 1, 4 )
If r = 3 Then lineAngle4add = Rnd( 1, 4 )
End If

' check If its time To change the color
If MilliSecs() > lastColorUpdate + colorUpdateRate
lastColorUpdate = MilliSecs()
lineColor1 = Rnd( 50, 255 )
lineColor2 = Rnd( 50, 255 )
lineColor3 = Rnd( 50, 255 )
End If

Flip

Wend
End
« Last Edit: July 21, 2007 by Shockwave »

Offline zawran

  • Sponsor
  • Pentium
  • *******
  • Posts: 909
  • Karma: 67
    • View Profile
Re: BlitzMax : Sinewaves
« Reply #1 on: July 12, 2006 »
This is also taken directly off my tutorial page without any changes. [edit] btw. it was never posted on any blitzmax forum, none of my tutorial examples have actually.
« Last Edit: July 12, 2006 by zawran »

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: BlitzMax : Sinewaves
« Reply #2 on: July 12, 2006 »
Zawran, I am sorry about this I checked the TOS which I wrote for this site and although there was a large part of the old TOS devoted to code posts, I have neglected to put it into this forum. This will be rectified.

Sometimes if someone asks for help on something then it is acceptable to post code snippets, rootuid seems to have posted these sources to help out, the fact that they are yours I can only apologise for as they have been posted without your permission. In fairness he has not claimed that he wrote them, he has just not credited you because he says he did not know who the author is, I think you can consider yourself credited and please accept my apologies.

If you would like me to remove these posts, please PM me and I will do so.
Shockwave ^ Codigos
Challenge Trophies Won:

Offline zawran

  • Sponsor
  • Pentium
  • *******
  • Posts: 909
  • Karma: 67
    • View Profile
Re: BlitzMax : Sinewaves
« Reply #3 on: July 12, 2006 »
No problem no need for apologies, no fault of yours. I don't mind them being posted here, but it would have been nice with a mention. Its just that I recieved an email from a guy, who I believe is Rootuid the other day where he mentions my website and demos, and I could only draw the conclusion that he would have known where he got them from if he had just visited my website the day before. But anyways, its alright that they are posted here, they were made to help people get started anyways, and since that is one of the purposes of this forum, its all good. If fact, as soon as I find the time, I will post all of my tutorials here if you don't mind. I have been wanting to redo my website for a while now anyways, and I want to remove my own forum as well. I will be placing a link on my demo page telling people to come to this forum for help with demo coding. Its much better to just have one place to gather everyone where all can benefit from the answers.

I haven't been too active lately, work and private matters have been keeping me from coding too much, which is why I haven't been contributing to the challenges either, even though I really wanted to. I am hoping that this will change soon enough though as I would like to be able to contribute more to the forum than I have been able to so far.


Offline Dad1916

  • Atari ST
  • ***
  • Posts: 112
  • Karma: 3
    • View Profile
Re: BlitzMax : Sinewaves
« Reply #4 on: July 12, 2006 »
sorry about the confusion.I never claimed I wrote it although I didn't say I didn't either. I didn't mean to imply that I had written the code.I posted 4 bits of code that are relevant to the demo scene, I forgot to update two of them to reflect this. I did update two though:
Rasterbars:not sure who wrote them but someone on the Blitzmax forums I think.
Sinewaves:not sure who wrote this, picked it up on the BlitzMax forums.

sorry for the confusion again. I didn't claim or mean to claim I wrote them. A lot of the BlitzMax code I pickup comes from the BlitzMax forums.zawran pointed me towards this great forum as he said above. Looking forward to seeing the rest of your stuff when you get the time Zarwan.
 :( :( :( :(
« Last Edit: July 12, 2006 by rootuid »

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17414
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: BlitzMax : Sinewaves
« Reply #5 on: July 13, 2006 »
All good and everyone's still friends then :) Cool!
Zawran, I know that lots of people will find your code snippets very handy if you feel like posting them in here please do so with my thanks :)
Shockwave ^ Codigos
Challenge Trophies Won: