dao Posted May 16, 2009 Author Share Posted May 16, 2009 Over the last couple of weeks i found Alot of cool codes for my game so im going to share one with you.this is were it snows and you can draw and stuff its pretty cool. ok so here we gomake a new mod and name it Snow_moduleand put this inside of it> '=======================================> ' The year 2020> '=======================================> > Option Explicit> > Type xParticle> X As Integer> Y As Integer> oldX As Integer> oldY As Integer> iStopped As Integer> End Type> > Global Const MAXP = 400> > Global Const PSIZE = 1> > Global Snow(0 To MAXP) As xParticlethen make a new form and name it frmmaindouble click it and put this code in it> Private Sub Form_Load()> > Randomize> > Me.ScaleMode = vbPixels> Me.DrawWidth = PSIZE> Me.BackColor = vbBlack> > > Dim i As Integer> > ' The RND formula!> ' Int((upperbound - lowerbound + 1) * Rnd + lowerbound)> > For i = 0 To MAXP> Snow(i).X = CInt(Int(Me.ScaleWidth * Rnd))> Snow(i).Y = CInt(Int(Me.ScaleHeight * Rnd))> Next i> > bRUN = True> Timer1.Enabled = True> > ' Center and draw the text:> Const sTEXT = "T H E Y E A R 2 0 2 0"> Me.ForeColor = vbRed> Me.CurrentX = Me.ScaleWidth / 2 - TextWidth(sTEXT) / 2> Me.CurrentY = Me.ScaleHeight / 2 - TextHeight(sTEXT) / 2 - 5> Me.Print sTEXT> > Const sTEXT2 = ""> Me.CurrentX = Me.ScaleWidth / 2 - TextWidth(sTEXT2) / 2> Me.CurrentY = Me.ScaleHeight / 2 + TextHeight(sTEXT2) + 2> Me.Print sTEXT2> > Me.ForeColor = vbWhite> > End Sub> > Sub DrawSnow()> Dim i As Integer> > Dim NewX As Integer> Dim NewY As Integer> > Timer1.Enabled = False> > Do While bRUN> > For i = 0 To MAXP> Me.PSet (Snow(i).oldX, Snow(i).oldY), vbBlack> Me.PSet (Snow(i).X, Snow(i).Y)> Next i> > For i = 0 To MAXP> Snow(i).oldX = Snow(i).X> Snow(i).oldY = Snow(i).Y> > ' A trick to get both positive and negative random values:> NewX = Snow(i).X + Int(2 * Rnd)> NewX = NewX - Int(2 * Rnd)> > ' Don't alow our snow to run away:> If NewX < 0 Then NewX = 0> If NewX >= Me.ScaleWidth Then NewX = Me.ScaleWidth - 1> > NewY = Snow(i).Y + 1> > If Me.Point(NewX, NewY) = vbBlack Then> Snow(i).Y = NewY> Snow(i).X = NewX> Else> If Snow(i).iStopped = 10 Then ' if stopped 10 times, make new!> > ' Move according to basic SNOW RULE:> If Me.Point(Snow(i).X + 1, Snow(i).Y + 1) = vbBlack Then> Snow(i).X = Snow(i).X + 1> Snow(i).Y = Snow(i).Y + 1> Snow(i).iStopped = 0> ElseIf Me.Point(Snow(i).X - 1, Snow(i).Y + 1) = vbBlack Then> Snow(i).X = Snow(i).X - 1> Snow(i).Y = Snow(i).Y + 1> Snow(i).iStopped = 0> Else> newParticle (i)> End If> > Else> Snow(i).iStopped = Snow(i).iStopped + 1> End If> End If> > If (Snow(i).Y) >= Me.ScaleHeight Then> newParticle (i)> End If> > Next i> > DoEvents> Loop> > End Sub> > Sub newParticle(i As Integer)> Snow(i).X = CInt(Int(Me.ScaleWidth * Rnd))> Snow(i).Y = 0> Snow(i).oldX = 0> Snow(i).oldY = 0> Snow(i).iStopped = 0> End Sub> > Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)> Me.PSet (X, Y)> bMOUSE_DOWN = True> fMouseDown_X = X> fMouseDown_Y = Y> End Sub> > Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)> If bMOUSE_DOWN Then> Dim oldDW As Long> Dim oldFC As Long> oldDW = Me.DrawWidth> oldFC = Me.ForeColor> Me.DrawWidth = 3> Me.ForeColor = vbWhite> Me.Line (fMouseDown_X, fMouseDown_Y)-(X, Y)> fMouseDown_X = X> fMouseDown_Y = Y> Me.DrawWidth = oldDW> Me.ForeColor = oldFC> End If> End Sub> > Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)> bMOUSE_DOWN = False> End Sub> > Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)> bRUN = False> End Sub> > Private Sub Timer1_Timer()> DrawSnow> End SubChange this to whatever you wantChange this to the color you want when you drawthen add a timer called timer1it should look like this![](http://www.freemmorpgmaker.com/files/imagehost/pics/89f2e8a564e82862a9f2dbbb8e1788f4.png)then add a command button where you want to open it and put this code inside> frmMain.Visible = True> Me.Visible = TrueThis is what it looks like when your done![](http://www.freemmorpgmaker.com/files/imagehost/pics/552884986feb5e30f1624ea51200e50f.png) Link to comment Share on other sites More sharing options...
Zawk Posted May 16, 2009 Share Posted May 16, 2009 coolcool. i thought it was going to be related to the current weather in game… so if its raining in game it rains on your client... sort of thing.as in.. before logging in. :) Link to comment Share on other sites More sharing options...
dao Posted May 16, 2009 Author Share Posted May 16, 2009 yep. i like this because its like REAL snow and it piles up on text and stuff and it piles up on the stuff you draw. Link to comment Share on other sites More sharing options...
Guest Posted May 16, 2009 Share Posted May 16, 2009 You my friend have made a partical system ;) Link to comment Share on other sites More sharing options...
dao Posted May 16, 2009 Author Share Posted May 16, 2009 idk what that is but cool Link to comment Share on other sites More sharing options...
Guest Posted May 16, 2009 Share Posted May 16, 2009 You could make this to depict the In game weather Link to comment Share on other sites More sharing options...
dao Posted May 16, 2009 Author Share Posted May 16, 2009 hmm i can… but i dont want to too much work. you can lol Link to comment Share on other sites More sharing options...
Guest Posted May 16, 2009 Share Posted May 16, 2009 Meh ill talk to unnown about it Link to comment Share on other sites More sharing options...
dao Posted May 16, 2009 Author Share Posted May 16, 2009 good idea. lol the real snow thing would be pretty awesome with real snow actually piling up on the ground. i look forward to that Link to comment Share on other sites More sharing options...
Guest Posted May 16, 2009 Share Posted May 16, 2009 wait where did you learn this from cause you have made one of the most awsumest fetchers ever, you can have a real fire Link to comment Share on other sites More sharing options...
dao Posted May 16, 2009 Author Share Posted May 16, 2009 like i said i went snooping around and found alot of tutorials and codes and by real fire this means? Link to comment Share on other sites More sharing options...
westin444 Posted May 16, 2009 Share Posted May 16, 2009 Heres a fair particle system that could make a fairly nice one:[A Simple Point Sprite Based Particle Engine](http://www.gamedev.net/reference/articles/article2002.asp) Link to comment Share on other sites More sharing options...
dao Posted May 16, 2009 Author Share Posted May 16, 2009 cool. ima try to make that Link to comment Share on other sites More sharing options...
unnown Posted May 16, 2009 Share Posted May 16, 2009 dx8 to bad, have to convert everything then :P anyhow the idea is still amazing :P Link to comment Share on other sites More sharing options...
dao Posted May 16, 2009 Author Share Posted May 16, 2009 its just fun but real snow in the game is a great idea i dont know how id do that unknown wanna give it a try? Link to comment Share on other sites More sharing options...
unnown Posted May 17, 2009 Share Posted May 17, 2009 yeah i know Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now