• Welcome to Dark Bit Factory & Gravity.
 

BlitzMax : Bob[BMAX]

Started by Dad1916, July 12, 2006

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Dad1916

A simple bob effect. Sphere.png is attached.  O0



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

zawran

#1
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.

Dad1916

Zarran,
Looking forward to the rest of your code appearing here :)

Shockwave

Thanks muchly Zawran :)
Good luck with the new site, though to be perfectly honest I like the one you have at the moment!
Shockwave ^ Codigos
Challenge Trophies Won:

zawran

Its not going to change much lookwise, I think, I am just going to cut some stuff away.