Dark Bit Factory & Gravity

PROGRAMMING => Other languages => Blitz => Topic started by: Dad1916 on July 12, 2006

Title: BlitzMax : Bob[BMAX]
Post by: Dad1916 on July 12, 2006
A simple bob effect. Sphere.png is attached.  O0
(http://www.dinneen.eu/images/bob.jpg)

Code: [Select]
Graphics 800,600,0
 Local bobImage:TImage = LoadImage( "sphere.png" ) ' load the image we use for the bobs
MidHandleImage bobImage ' set the handle to the center

Local i:Int, bobXadd:Int, bobYadd:Int, bobUpdate

Local bobx[64], boby[64] ' setup placeholders for x and y position for the bobs
For i = 0 To 63
bobx( i ) = i * 4 Mod 360 ' space the positions out a little
boby( i ) = i * 3 Mod 360 ' using Mod to keep the numbers between 0 and 360
Next

bobXadd = 1 ' this is the values we add to move the bobs
bobYadd = 2 ' change these For different patterns

While Not KeyHit(1)

Cls

For i = 0 To 63
DrawImage bobImage, 400 + Sin( bobx[i] ) * 304, 240 + Sin( boby[i] ) * 224 ' draw the bobs onto the screen
Next

If MilliSecs() > bobsUpdate + 15 Then ' here we find the next position of the bobs
bobsUpdate = MilliSecs()
For i = 0 To 63
bobx[i] = bobx[i] + bobXadd Mod 360
boby[i] = boby[i] + bobYadd Mod 360
Next
End If

Flip

Wend
End
Title: Re: BlitzMax : Bob
Post by: zawran on July 12, 2006
Would have been nice if you had mentioned that this code and gfx was taken directly off the tutorial page on my website without any changes.

[edit] now that I have had time to thing about it, its alright since I will be posting all of my tutorials sometime this coming weekend, if SW think that they would be of any use in the blitz section. This way everyone can benefit from them, and it will be clear where they came from. I will be closing down my own forum this weekend as well, and redo my website, and replace my tutorials with a link to this forum because people are much better helped here since I don't have too much time currently and there are a lot of good people here to help out.
Title: Re: BlitzMax : Bob
Post by: Dad1916 on July 13, 2006
Zarran,
Looking forward to the rest of your code appearing here :)
Title: Re: BlitzMax : Bob
Post by: Shockwave on July 13, 2006
Thanks muchly Zawran :)
Good luck with the new site, though to be perfectly honest I like the one you have at the moment!
Title: Re: BlitzMax : Bob
Post by: zawran on July 13, 2006
Its not going to change much lookwise, I think, I am just going to cut some stuff away.