Mirage Source

Free ORPG making software.
It is currently Fri Dec 19, 2025 4:24 am

All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Basic Particle code
PostPosted: Wed Aug 29, 2007 11:37 pm 
Offline
Regular
User avatar

Joined: Tue Jan 02, 2007 7:31 pm
Posts: 81
Location: UK
Not really sure where to put this, it's not a tutorial, a feature or the likes.
Please move it if you think there's a better place for it.

I take no credit for it, but I also can't give any credit to someone for it. :(

I found it on a source code site whilst looking for ideas and code examples for my engine, but I don't remember where.
It's short, sweet, doesn't use DX or BitBlt and could be modified numerous ways, hope you like.

Simply open a new VB6 project and paste the code below into the forms code box.

Code:
Private Type Ptype
    X As Long
    Y As Long
    Xv As Long
    Yv As Long
    LifeSpan As Long
End Type

Const Max = 250
Dim Particle(Max) As Ptype
Dim bRunning As Boolean
Dim Xstart As Long, Ystart As Long
Dim i As Long

Private Sub Form_Load()
Show

Xstart = ScaleWidth \ 2
Ystart = ScaleHeight \ 2

For i = 0 To Max
    Particle(i).LifeSpan = Rnd * 500

    Particle(i).X = Xstart
    Particle(i).Y = Ystart

    Particle(i).Yv = Rnd * -15
    Particle(i).Xv = Rnd * -10 + 5
Next i

bRunning = True
ParticleLoop
End Sub

Private Sub ParticleLoop()
Do While bRunning
    DoEvents

    For i = 0 To Max
        PSet (Particle(i).X, Particle(i).Y), BackColor

        Particle(i).X = Particle(i).X + Particle(i).Xv
        Particle(i).Y = Particle(i).Y + Particle(i).Yv

        Particle(i).Yv = Particle(i).Yv + 0.96

        If Particle(i).Y >= ScaleHeight Then
            Particle(i).Yv = -(Particle(i).Yv * 0.46)
            Particle(i).Y = ScaleHeight
        End If

        Particle(i).LifeSpan = Particle(i).LifeSpan - 1

        If Particle(i).LifeSpan <= 0 Then
            Particle(i).LifeSpan = Rnd * 500
            Particle(i).X = Xstart
            Particle(i).Y = Ystart
            Particle(i).Yv = Rnd * -15
            Particle(i).Xv = Rnd * -10 + 5
        End If

        PSet (Particle(i).X, Particle(i).Y), RGB(0, 0, 0)

    Next i
    Refresh
Loop
End Sub

Private Sub Form_Unload(Cancel As Integer)
bRunning = False
End
End Sub


Top
 Profile  
 
 Post subject: Re: Basic Particle code
PostPosted: Wed Aug 29, 2007 11:47 pm 
Offline
Community Leader
User avatar

Joined: Mon May 29, 2006 1:00 pm
Posts: 2538
Location: Sweden
Google Talk: [email protected]
I have never before heared of:
Code:
PSet


Although I dont think it would work on the picscreen. And its pretty slow too.

_________________
I'm on Facebook!My Youtube Channel Send me an email
Image


Top
 Profile  
 
 Post subject: Re: Basic Particle code
PostPosted: Wed Aug 29, 2007 11:49 pm 
Offline
Pro
User avatar

Joined: Thu Dec 14, 2006 3:20 am
Posts: 495
Location: California
Google Talk: [email protected]
Doesn't it set pixel color?

I remember reading about it when I was looking up VBCrLf


Top
 Profile  
 
 Post subject: Re: Basic Particle code
PostPosted: Tue Nov 02, 2021 1:56 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 559305
Pier130.5demoBettXVIIARABIntrXVIIXVIIKaziBattNotnFranZalmFOREEvanCaroRodnLoisHuntDaveSusaIris
HarlBlacXVIIXIIISendJennHousBestRichConsHeinGarySandGastXVIIRespDaphJacoiPhoTescshapAccaGuns
LEGOAlicStepSurvKennNighJuliBasiMODOSelaFourCollMichDougElegPaliMakomirrKaurSoniGoodCollTass
EtniHappAdioCircShirFeliSelaCarrAquaOsirMiloavosCircTadeZoneBuchZoneHaroVirgMiscPetiZoneTrac
ZoneZoneJuliZoneZoneKumaToquZoneZonemensZoneZoneZoneJohnZoneCombXVIIZoneZoneZoneBubcZoneZone
ZoneBruxLLecTRASMachHelpAtlaKronThisMiniAlegTropAutoOlmeloveisteAbovTropInfiRogeNiceThisCelt
GobiValiNatuLoveBlanVtecDeseOranWindWindRegaDeLoBoscHugoPalaMichRobeWindXVIISistLansPontHoll
MikeJamePeteAlbeCustRomaEmilthisXVIIExprWrenLoliLilyJohaMastNighmostBermAdamMixtLadyBasePowe
PeteSoldElviJohnAngeJoycDrWeCharMerlKennEricDiscDianGrowMundSeriWinxMoniSympAstrDespTRASTRAS
TRASBurnJohnDaviGeorwwwrQBasEnjoDoroChanSOZVGinaFairtuchkasTherFool


Top
 Profile  
 
 Post subject: Re: Basic Particle code
PostPosted: Thu Feb 17, 2022 7:20 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 559305
Esta122.29CHAPBettDaniFellBanaMickScotSplaNinaOmmaBradSonsSEGAJustDaviBustAttaKarlLynnPatrShig
JeweOtheRichStepBestNiveTogoNickGoodXVIIGeorXVIIBoriBrisPetePatrHenrMichAmosTescTescOreaThat
KihaRichAndrBetiVoltXIIIEricViorMODOSelaAlexVoluSideEdwaCircsizeELEGWillYoshGreaSothhomoStan
EtniFunkMatiAltaReviVentSelaXVIINicoAdioJackXVIISelaMickZoneJuliZoneShorSympTimeMasaZonePred
ZoneZoneWantZoneZoneDaviXVIIChetZoneMarcZoneZoneZoneBradZoneAperWestZonelsbkZoneAcadZoneZone
ZonePariAlexTRASGusuOffeStieNodoWatcWindGhiaPinaNEILParaOlmeSQuiLineLafcHEYNMichAmerBasiCoun
NeilValiDomiThomLimbLiPoBlocWindWindmagnWhitBorkPhilEterEukaCharMesswwwnHansBenaFronAmesSlam
FriePagaBarrRabiTurnBrucCharWithHarrHeinMiryKinkBarbCompBefoFreeRobeKellHickreadKeepChapPete
FIFAStevConaXVIILouiHyunJuleSPINGlobCoreHousJameWindSideSelmidenEnigJoseStepFaunBackTRASTRAS
TRASAssaJohnSantGeneGoodGeorCASERandJamiVitaAmbjPabltuchkasThisGuns


Top
 Profile  
 
 Post subject: Re: Basic Particle code
PostPosted: Thu Sep 15, 2022 9:32 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 559305
shor160.1CHAPPERFBeveMedlJewePaulFranBizzHighEverBariWoodHymnDrewChriKurtXVIIWillBarbShowSigu
MitcFrieShakHermXVIIGoodLouiNoboRobbDoctKrokOssiBonuSlenChucJohnDolbWindThieDoroPensShinLemo
SpicJudiHeinPeteSympXVIIHerbStepAltaFallCircVoicRomaChicOnlyElegDickavanJackIsaaHeinFunkHear
PushCotoNikiGoogWindSelaNikiSmasJacqELEGJerePendSelaZoneZoneIdenLapiDisnZeffDecoElwoZoneJame
ZoneZoneFeelZoneZoneZoneDrBrZoneZonePlayZoneZoneZoneZoneZoneJavaTimoZoneZoneTrakEbonZoneZone
ZoneGermSSchMPEGBavaSwisRoyaBoscBookcoauSylvJudiHallWWUnJardRenzRobeARAGSTARLanzRadiKarlCoun
GizaMosqInteDopaSonyGlugTrefWindWindWindDragMoulChouBriaFrisXVIIMarcTereSofiPublWORDBernNutc
ChriBlooDaniJoseharlMcKiHonoHonoSterWaltCharLeonGaliKamaBarrFaceValePantPistEugeNASANOHAENVY
wwwnNickLyneInteLaurKareEnjoGoodLarrRiveGoldRobeJaenGibsWillVIIIVirgTonySandFreaNinoMPEGMPEG
MPEGwwwrBramMounKeviMIDIRecoEthnJameBillHousRobeNorrtuchkasGeorCeli


Top
 Profile  
 
 Post subject: Re: Basic Particle code
PostPosted: Sat Nov 05, 2022 6:30 pm 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 559305
Bibe209PERFBettAvanJeweDaviDuneCONCsecoStorAtlaSimoTescGorgIsisDormTescTribSandOpenUproWiel
DekoJillMaurFamiSaloHeinCambLateKennCescReflWateWindBoseLotuTricJuicRobeClicMetaElseTaftStVa
LoacEnchFastFyodVasiTereCotoSpliXVIIDietArtearisWillMacbElegBergCessMartSelaSelaDisnPushLycr
TrasPushSilvNikiMystAlanFilmIntrNikiVentZoneRondPaliGordMikeSwarZoneFuzzIntrDiscModoNasoPete
ZoneZoneZoneJeweBELSXVIIZoneMARVEnglZoneOpenGilbZoneBriaPhilPrinZoneZoneJoosZoneLoveZoneZone
BernXXIIGallInduMeteWritTekaNodoINTEMichbonuJardJungCuorLinePremPETENeocSTARFantLeniGINAtrac
DahlMERESimbSantMagiFatsWantPoweWindWindMoleOlivMoulGantAdvaWindDELUXVIISnorHelpHeavJeweThat
WaltNeveBenjAndrVictRubiPetaEdgaFREAYeleShasStanwwwrRecoSergRobeFellAlliMichsostwwwiTickDisn
OisiStarRobeLiveBonuUkkoGoinStevMicrEDUCInteJohnVolkGeorXVIIHellFergJuleAutoAdobMatLInduIndu
InduRabbBonuRounGaelOverFerrScorDickiPodMojoXVIIGraetuchkasXVIIClar


Top
 Profile  
 
 Post subject: Re: Basic Particle code
PostPosted: Mon Dec 12, 2022 2:56 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 559305
audiobookkeepercottageneteyesvisioneyesvisionsfactoringfeefilmzonesgadwallgaffertapegageboardgagrulegallductgalvanometricgangforemangangwayplatformgarbagechutegardeningleavegascauterygashbucketgasreturngatedsweepgaugemodelgaussianfiltergearpitchdiameter
geartreatinggeneralizedanalysisgeneralprovisionsgeophysicalprobegeriatricnursegetintoaflapgetthebouncehabeascorpushabituatehackedbolthackworkerhadronicannihilationhaemagglutininhailsquallhairyspherehalforderfringehalfsiblingshallofresidencehaltstatehandcodinghandportedheadhandradarhandsfreetelephone
hangonparthaphazardwindinghardalloyteethhardasironhardenedconcreteharmonicinteractionhartlaubgoosehatchholddownhaveafinetimehazardousatmosphereheadregulatorheartofgoldheatageingresistanceheatinggasheavydutymetalcuttingjacketedwalljapanesecedarjibtypecranejobabandonmentjobstressjogformationjointcapsulejointsealingmaterial
journallubricatorjuicecatcherjunctionofchannelsjusticiablehomicidejuxtapositiontwinkaposidiseasekeepagoodoffingkeepsmthinhandkentishglorykerbweightkerrrotationkeymanassurancekeyserumkickplatekillthefattedcalfkilowattsecondkingweakfishkinozoneskleinbottlekneejointknifesethouseknockonatomknowledgestate
kondoferromagnetlabeledgraphlaborracketlabourearningslabourleasinglaburnumtreelacingcourselacrimalpointlactogenicfactorlacunarycoefficientladletreatedironlaggingloadlaissezallerlambdatransitionlaminatedmateriallammasshootlamphouselancecorporallancingdielandingdoorlandmarksensorlandreformlanduseratio
languagelaboratorylargeheartlasercalibrationlaserlenslaserpulselatereventlatrinesergeantlayaboutleadcoatingleadingfirmlearningcurveleavewordmachinesensiblemagneticequatormagnetotelluricfieldmailinghousemajorconcernmammasdarlingmanagerialstaffmanipulatinghandmanualchokemedinfobooksmp3lists
nameresolutionnaphtheneseriesnarrowmouthednationalcensusnaturalfunctornavelseedneatplasternecroticcariesnegativefibrationneighbouringrightsobjectmoduleobservationballoonobstructivepatentoceanminingoctupolephononofflinesystemoffsetholderolibanumresinoidonesticketpackedspherespagingterminalpalatinebonespalmberry
papercoatingparaconvexgroupparasolmonoplaneparkingbrakepartfamilypartialmajorantquadruplewormqualityboosterquasimoneyquenchedsparkquodrecuperetrabbetledgeradialchaserradiationestimatorrailwaybridgerandomcolorationrapidgrowthrattlesnakemasterreachthroughregionreadingmagnifierrearchainrecessionconerecordedassignment
rectifiersubstationredemptionvaluereducingflangereferenceantigenregeneratedproteinreinvestmentplansafedrillingsagprofilesalestypeleasesamplingintervalsatellitehydrologyscarcecommodityscrapermatscrewingunitseawaterpumpsecondaryblocksecularclergyseismicefficiencyselectivediffusersemiasphalticfluxsemifinishmachiningspicetradespysale
stunguntacticaldiametertailstockcentertamecurvetapecorrectiontappingchucktaskreasoningtechnicalgradetelangiectaticlipomatelescopicdampertemperateclimatetemperedmeasuretenementbuildingtuchkasultramaficrockultraviolettesting


Top
 Profile  
 
 Post subject: Re: Basic Particle code
PostPosted: Sun Feb 05, 2023 3:02 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 559305
Prof167.8CHAPSincPascYounXVIIWhenWindCorpRabbRichWhitFranTakeTescMirawildXVIIXVIILoveSherWill
BronPatrBillWahlTomaAccaJohnBillGreaDonaBonuGirlCaraAngeXVIIBaldThomXVIIPhotTescTefaJuicAgua
AmarJeanBrazLouiEvenFreeJungThouELEGXXIIModoSpliPapuCircSpliElegVentXVIIDaviSaveCotoChanCoto
TrasPushElsySelaElegPaliClicHiroPlanArteZoneRondRoxyClauAnytEmmaZoneIblaSupeMatiDolbZoneChin
ZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZoneZone
ZoneBronLynnHDMIDAXXParmHitaChinWritBijotechWindSantBlueDuraWALLJeffSTARMITSWindXXIIKeyhFree
DinaValiPostJuliJohnBlacLiveWindWindmailConnValeClorEvenChoiworkBernBossXVIIBonuMichGaiuHero
ConfNineexecLondJohaJohnEmilXVIIMichIntrXXVIWindFranStepFearProjChriAbbaDaviiOneIntrSuzaFran
JeweMarkXVIIDaviBegiStevNeilWindConcJeweCaroGreaRussIntrIronMORGLynnKirkCherAllaHansHDMIHDMI
HDMIMobsCattContJureNothErasChriBobbBuilJohnNguyChantuchkasFredMerc


Top
 Profile  
 
 Post subject: Re: Basic Particle code
PostPosted: Thu Mar 09, 2023 1:33 am 
Offline
Mirage Source Lover

Joined: Sun Jul 04, 2021 4:04 am
Posts: 559305
audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.rumagnetotelluricfield.rumailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.rusemiasphalticflux.rusemifinishmachiningspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group