Dark Bit Factory & Gravity

PROGRAMMING => General coding questions => Topic started by: Pot Noodle on September 11, 2011

Title: Sinewave Help Please
Post by: Pot Noodle on September 11, 2011
Hi, I was wondering if some one could help me with this problem I have?
I have a routine that Shockwave knocked up for me to draw a sinewave scroller.
It works great but now I would like to make some changes to it and as maths is not
my strong point I once again find my self stuck again!

I have been trying to get the sinewave to randomly change like on some of the old
Amiga demos Amplitude change and so on, god this is hard to explain  :-[
Here is my code for the scroller.

Function Do_Scroller()
   
   ScrlPos:+2
   
   If ScrlPos > 16 Then
      ScrlPos:-16
      Textpos:+1
      If Textpos > Len(ScrollText) - 52 Textpos = 1
   End If
   
   Local DrawPos:Int
   Local TextAdd:Int
   Local Letters:Int
   
   TextAdd = 0
   DrawPos = (-16) - ScrlPos
      
    Repeat
      Letters = (Asc(Mid(ScrollText, (Textpos + TextAdd), 1)) - 32) * 16
      For Local IL:Int = 0 To 15
         DrawImage Font, DrawPos + IL, 300 + (70 * Sin(Sineadd + DrawPos + IL)), Letters + IL
      Next
      TextAdd:+1
      DrawPos:+16
   Until DrawPos >= xRes
   
End Function

Thanks for any help.
Title: Re: Sinewave Help Please
Post by: Raizor on September 11, 2011
Trying changing the value of "Sineadd" each time Do_Scroller is called.

Increase or decrease its value by 1 each time. That may help.
Title: Re: Sinewave Help Please
Post by: Pot Noodle on September 12, 2011
If only it was that simple, I had tried that and what ever value I make it the sine remains the same.
It must be the way the Sin() function is setup, I was wondering if there was a different way so it would
be more manageable.
Title: Re: Sinewave Help Please
Post by: Raizor on September 12, 2011
Pot Noodle, which language is this, blitz?  If so, I'm just curious why you don't use Freebasic/Purebasic?
Title: Re: Sinewave Help Please
Post by: jace_stknights on September 12, 2011
Pot Noodle, which language is this, blitz?  If so, I'm just curious why you don't use Freebasic/Purebasic?
:clap:
Title: Re: Sinewave Help Please
Post by: Hotshot on September 12, 2011
Quote
Pot Noodle, which language is this, blitz?  If so, I'm just curious why you don't use Freebasic/Purebasic?

Well, The Freebasic/Purebasic had smaller Files size than Blitz Max(Correct me if I am wrong) as far as I know but end of day....it down to the person who are Comfortable with the programming Language(if he happy with BlitzMax then so be it  :clap:)
Title: Re: Sinewave Help Please
Post by: Raizor on September 12, 2011
Quote
Pot Noodle, which language is this, blitz?  If so, I'm just curious why you don't use Freebasic/Purebasic?

Well, The Freebasic/Purebasic had smaller Files size than Blitz Max(Correct me if I am wrong) as far as I know but end of day....it down to the person who are Comfortable with the programming Language(if he happy with BlitzMax then so be it  :clap:)

Hehe, I'm just curious, that's all :) 
Title: Re: Sinewave Help Please
Post by: Shockwave on September 12, 2011
   DrawImage Font, DrawPos + IL, 300 + (70 * Sin(Sineadd + DrawPos + IL)), Letters + IL

The number in red is the amplitude.
Title: Re: Sinewave Help Please
Post by: Pot Noodle on September 12, 2011
Thanks Shockwave I did try that, must be me then, But Raizor can you tell me the gain I would have using PureBasic
or FreeBasic and to witch one would you use? if you were using Blitzmax.
Pros & Cons would be nice, I am willing to be converted and you are going to wish you never asked me that!  ;D

Title: Re: Sinewave Help Please
Post by: Raizor on September 12, 2011
Thanks Shockwave I did try that, must be me then, But Raizor can you tell me the gain I would have using PureBasic
or FreeBasic and to witch one would you use? if you were using Blitzmax.
Pros & Cons would be nice, I am willing to be converted and you are going to wish you never asked me that!  ;D

I just think it would probably make life easier for you as there seem to be a lot more people here who use freebasic and purebasic. I'm starting to play with freebasic a bit, so I can probably help with things in future. I'm certainly not trying to convert you, I was just curious as to why you chose blitz :)
Title: Re: Sinewave Help Please
Post by: Pot Noodle on September 12, 2011
No problem, But you do realize what you have done don't you?
is there more PureBasic users than DarkBasic user's?, I have just had a look at them both "Dammit You Got Me Thinking"
If anyone has preference over these two please let me know, Thanks Raizor.
Title: Re: Sinewave Help Please
Post by: Hotshot on September 12, 2011
Purebasic is Much better than Darkbasic!! But end of the day...It down to you on what you are Comfortable with the programming Language...

The Purebasic users on here are

padman
energy
jace_stknights
Raizor (He going have try on freebasic to see if he like it)
Vain   (He used purebasic before but I dont know what Programming language he using...maybe c#)

Freebasic User

Shockwave
relsoft
rbz
Storm Trooper
rdc

I cant think of anymore but make own Choice  ;D



Title: Re: Sinewave Help Please
Post by: Rbz on September 13, 2011
... But Raizor can you tell me the gain I would have using PureBasic
or FreeBasic and to witch one would you use? if you were using Blitzmax.
Pros & Cons would be nice, I am willing to be converted and you are going to wish you never asked me that!  ;D
IMO, you can do wonders with Blitzmax, just seeing things done with it on the blitz website.
Just try to learn as much as you can about it, and then you can try another compiler and see which one suits better to you.
Title: Re: Sinewave Help Please
Post by: Jim on September 13, 2011
Changing languages ain't gonna fix the problem..!  For the record, I'm a C/C++/C# man, I use the original BlitzBasic to do rapid prototyping, and I've been known to dabble in FreeBasic.

V = A * sin(F)

A is the amplitude, F is the frequency.  If you want larger waves, increase A.  If you want the wiggles to be closer together, increase the increments of F.

Jim
Title: Re: Sinewave Help Please
Post by: jace_stknights on September 13, 2011
http://www.dbfinteractive.com/forum/index.php?topic=5357.0 (http://www.dbfinteractive.com/forum/index.php?topic=5357.0)

This topic speaks about Sinescroll, with examples in Purebasic...
Title: Re: Sinewave Help Please
Post by: Pot Noodle on September 13, 2011
Thanks Jim, I finally got the answer I was after  :goodpost: and thanks to you all for  the info on other languages.