Mirage Source
http://www.miragesource.net/forums/

Gravity Tiles
http://www.miragesource.net/forums/viewtopic.php?f=210&t=2242
Page 1 of 1

Author:  Rezeyu [ Sat Jul 07, 2007 9:40 pm ]
Post subject:  Gravity Tiles

Just something small I made for my game, and.. I've never written a tutorial yet, so I figured I should try and actually contribute something. This should work in a vanilla MSE, I can't see why it wouldn't.

Client Side:


Add this to your Constants, under the other tiles:
Code:
Public Const TILE_TYPE_GRAVITY = 7



Find:
Code:
If .Type = TILE_TYPE_KEYOPEN Then Call DrawText


Under it add:
Code:
If .Type = TILE_TYPE_GRAVITY Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "Grav", QBColor(Magenta))



Find:
Code:
If frmMirage.optKeyOpen.Value = True Then
                        .Type = TILE_TYPE_KEYOPEN
                        .Data1 = KeyOpenEditorX
                        .Data2 = KeyOpenEditorY
                        .Data3 = 0
                    End If



Under it add:
Code:
If frmMirage.OptGravity.Value = True Then
                        .Type = TILE_TYPE_GRAVITY
                        .Data1 = 0
                        .Data2 = 0
                        .Data3 = 0
                    End If



Now: Of course you need to go into frmMirage and add OptGravity to the other attributes for the map editor.




Server Side:

In your Server constants, add this under the other tiles:
Code:
Public Const TILE_TYPE_GRAVITY = 7




Finally, Find:
Code:
Sub PlayerMapDropItem


Then Dim these:
Code:
Dim Yloc As Long, x As Long, y As Long


In the Sub, find these lines:
Code:
' Send inventory update
            Call SendInventoryUpdate(Index, InvNum)


And right under them add this block of code:
Code:
            ' Apply Gravity
            Yloc = GetPlayerY(Index)
            For y = 0 To MAX_MAPY
                For x = 0 To MAX_MAPX
                    If Map(GetPlayerMap(Index)).Tile(x, Yloc).Type = TILE_TYPE_GRAVITY Then
                        Yloc = Yloc + 1
                    End If
                Next x
            Next y


And... you're done.
If a player tries to drop an object onto a gravity tile, it will move it down one space, if that tile is also gravity type, it will keep being pulled until it hits a non-gravity tile.

I used these for ladders in my game, becasue I thought it looked stupid when people dropped items floating on a ladder.
Now the itmes fall straight to the bottom of the ladder's base.


This can be expanded on easily too..
Maybe make NPCs fall down them, or something.



EDIT:

Cruzn wrote:
In Sub PlayerMapDropItem, Find:
Code:
Call SpawnItemSlot(i, MapItem(GetPlayerMap(Index), i).Num, Ammount, MapItem(GetPlayerMap(Index), i).Dur, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index))

Replace With:
Code:
Call SpawnItemSlot(i, MapItem(GetPlayerMap(Index), i).Num, Ammount, MapItem(GetPlayerMap(Index), i).Dur, GetPlayerMap(Index), GetPlayerX(Index), Yloc)

Author:  Cruzn [ Sun Jul 08, 2007 4:43 am ]
Post subject:  Re: Gravity Tiles

I think you're missing one last part. ;-)

-- Server Side

In Sub PlayerMapDropItem, Find:
Code:
Call SpawnItemSlot(i, MapItem(GetPlayerMap(Index), i).Num, Ammount, MapItem(GetPlayerMap(Index), i).Dur, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index))

Replace With:
Code:
Call SpawnItemSlot(i, MapItem(GetPlayerMap(Index), i).Num, Ammount, MapItem(GetPlayerMap(Index), i).Dur, GetPlayerMap(Index), GetPlayerX(Index), Yloc)

Author:  Rezeyu [ Sun Jul 08, 2007 6:52 pm ]
Post subject:  Re: Gravity Tiles

Hah, yeah forgot that, Updating right now, thanks.

Author:  Rian [ Sun Jul 08, 2007 7:42 pm ]
Post subject:  Re: Gravity Tiles

Props dude. This is a pretty neat tutorial. :D

Author:  William [ Wed Jul 11, 2007 4:00 pm ]
Post subject:  Re: Gravity Tiles

I didnt really look at it that much since Im in a Internet cafe, but this could be used for a waterfall and such then?

Author:  Matt [ Wed Jul 11, 2007 4:11 pm ]
Post subject:  Re: Gravity Tiles

Yupp.

Could easily make it slide npcs and players.

Author:  wisefire [ Tue Jul 17, 2007 3:51 am ]
Post subject:  Re: Gravity Tiles

Change this to work for players and npc and you have yourself a side scrolling rpg.

Very Nice indeed.

Author:  Rezeyu [ Tue Jul 17, 2007 4:19 am ]
Post subject:  Re: Gravity Tiles

If you wanted it like that you'd do it with a timer.

Author:  Braydok [ Tue Aug 14, 2007 2:06 am ]
Post subject:  Re: Gravity Tiles

Right now I'm trying to make the item slide down gradually, instead of just jumping to the bottom, I will post when ever I get it figure out, (or someone can figure it out before me and post it.)

Author:  Rezeyu [ Tue Aug 14, 2007 6:00 pm ]
Post subject:  Re: Gravity Tiles

Psst.


Look at the way the client uses the Y offset for NPCs and Players.

Author:  wanai [ Thu Dec 16, 2021 10:46 am ]
Post subject:  Re: Gravity Tiles

http://audiobookkeeper.ruhttp://cottagenet.ruhttp://eyesvision.ruhttp://eyesvisions.comhttp://factoringfee.ruhttp://filmzones.ruhttp://gadwall.ruhttp://gaffertape.ruhttp://gageboard.ruhttp://gagrule.ruhttp://gallduct.ruhttp://galvanometric.ruhttp://gangforeman.ruhttp://gangwayplatform.ruhttp://garbagechute.ruhttp://gardeningleave.ruhttp://gascautery.ruhttp://gashbucket.ruhttp://gasreturn.ruhttp://gatedsweep.ruhttp://gaugemodel.ruhttp://gaussianfilter.ruhttp://gearpitchdiameter.ru
http://geartreating.ruhttp://generalizedanalysis.ruhttp://generalprovisions.ruhttp://geophysicalprobe.ruhttp://geriatricnurse.ruhttp://getintoaflap.ruhttp://getthebounce.ruhttp://habeascorpus.ruhttp://habituate.ruhttp://hackedbolt.ruhttp://hackworker.ruhttp://hadronicannihilation.ruhttp://haemagglutinin.ruhttp://hailsquall.ruhttp://hairysphere.ruhttp://halforderfringe.ruhttp://halfsiblings.ruhttp://hallofresidence.ruhttp://haltstate.ruhttp://handcoding.ruhttp://handportedhead.ruhttp://handradar.ruhttp://handsfreetelephone.ru
http://hangonpart.ruhttp://haphazardwinding.ruhttp://hardalloyteeth.ruhttp://hardasiron.ruhttp://hardenedconcrete.ruhttp://harmonicinteraction.ruhttp://hartlaubgoose.ruhttp://hatchholddown.ruhttp://haveafinetime.ruhttp://hazardousatmosphere.ruhttp://headregulator.ruhttp://heartofgold.ruhttp://heatageingresistance.ruhttp://heatinggas.ruhttp://heavydutymetalcutting.ruhttp://jacketedwall.ruhttp://japanesecedar.ruhttp://jibtypecrane.ruhttp://jobabandonment.ruhttp://jobstress.ruhttp://jogformation.ruhttp://jointcapsule.ruhttp://jointsealingmaterial.ru
http://journallubricator.ruhttp://juicecatcher.ruhttp://junctionofchannels.ruhttp://justiciablehomicide.ruhttp://juxtapositiontwin.ruhttp://kaposidisease.ruhttp://keepagoodoffing.ruhttp://keepsmthinhand.ruhttp://kentishglory.ruhttp://kerbweight.ruhttp://kerrrotation.ruhttp://keymanassurance.ruhttp://keyserum.ruhttp://kickplate.ruhttp://killthefattedcalf.ruhttp://kilowattsecond.ruhttp://kingweakfish.ruhttp://kinozones.ruhttp://kleinbottle.ruhttp://kneejoint.ruhttp://knifesethouse.ruhttp://knockonatom.ruhttp://knowledgestate.ru
http://kondoferromagnet.ruhttp://labeledgraph.ruhttp://laborracket.ruhttp://labourearnings.ruhttp://labourleasing.ruhttp://laburnumtree.ruhttp://lacingcourse.ruhttp://lacrimalpoint.ruhttp://lactogenicfactor.ruhttp://lacunarycoefficient.ruhttp://ladletreatediron.ruhttp://laggingload.ruhttp://laissezaller.ruhttp://lambdatransition.ruhttp://laminatedmaterial.ruhttp://lammasshoot.ruhttp://lamphouse.ruhttp://lancecorporal.ruhttp://lancingdie.ruhttp://landingdoor.ruhttp://landmarksensor.ruhttp://landreform.ruhttp://landuseratio.ru
http://languagelaboratory.ruhttp://largeheart.ruhttp://lasercalibration.ruhttp://laserlens.ruhttp://laserpulse.ruhttp://laterevent.ruhttp://latrinesergeant.ruhttp://layabout.ruhttp://leadcoating.ruhttp://leadingfirm.ruhttp://learningcurve.ruhttp://leaveword.ruhttp://machinesensible.ruhttp://magneticequator.ruhttp://magnetotelluricfield.ruhttp://mailinghouse.ruhttp://majorconcern.ruhttp://mammasdarling.ruhttp://managerialstaff.ruhttp://manipulatinghand.ruhttp://manualchoke.ruhttp://medinfobooks.ruhttp://mp3lists.ru
http://nameresolution.ruhttp://naphtheneseries.ruhttp://narrowmouthed.ruhttp://nationalcensus.ruhttp://naturalfunctor.ruhttp://navelseed.ruhttp://neatplaster.ruhttp://necroticcaries.ruhttp://negativefibration.ruhttp://neighbouringrights.ruhttp://objectmodule.ruhttp://observationballoon.ruhttp://obstructivepatent.ruhttp://oceanmining.ruhttp://octupolephonon.ruhttp://offlinesystem.ruhttp://offsetholder.ruhttp://olibanumresinoid.ruhttp://onesticket.ruhttp://packedspheres.ruhttp://pagingterminal.ruhttp://palatinebones.ruhttp://palmberry.ru
http://papercoating.ruhttp://paraconvexgroup.ruhttp://parasolmonoplane.ruhttp://parkingbrake.ruhttp://partfamily.ruhttp://partialmajorant.ruhttp://quadrupleworm.ruhttp://qualitybooster.ruhttp://quasimoney.ruhttp://quenchedspark.ruhttp://quodrecuperet.ruhttp://rabbetledge.ruhttp://radialchaser.ruhttp://radiationestimator.ruhttp://railwaybridge.ruhttp://randomcoloration.ruhttp://rapidgrowth.ruhttp://rattlesnakemaster.ruhttp://reachthroughregion.ruhttp://readingmagnifier.ruhttp://rearchain.ruhttp://recessioncone.ruhttp://recordedassignment.ru
http://rectifiersubstation.ruhttp://redemptionvalue.ruhttp://reducingflange.ruhttp://referenceantigen.ruhttp://regeneratedprotein.ruhttp://reinvestmentplan.ruhttp://safedrilling.ruhttp://sagprofile.ruhttp://salestypelease.ruhttp://samplinginterval.ruhttp://satellitehydrology.ruhttp://scarcecommodity.ruhttp://scrapermat.ruhttp://screwingunit.ruhttp://seawaterpump.ruhttp://secondaryblock.ruhttp://secularclergy.ruhttp://seismicefficiency.ruhttp://selectivediffuser.ruинфоhttp://semifinishmachining.ruhttp://spicetrade.ruhttp://spysale.ru
http://stungun.ruhttp://tacticaldiameter.ruhttp://tailstockcenter.ruhttp://tamecurve.ruhttp://tapecorrection.ruhttp://tappingchuck.rutaskreasoning.ruhttp://technicalgrade.ruhttp://telangiectaticlipoma.ruhttp://telescopicdamper.ruсайтhttp://temperedmeasure.ruhttp://tenementbuilding.rutuchkashttp://ultramaficrock.ruhttp://ultraviolettesting.ru

Author:  wanai [ Fri Feb 11, 2022 3:37 am ]
Post subject:  Re: Gravity Tiles

stud77.7ReprBettClifXVIICoolToujFlasBizzHangRobeTescJeweLucyDekoDireNaviAnguStriImmaXVIIVerd
BurdDanyGordFiskMaurDailTracAlleLeveAlexGiovJoseMungOpenXVIIOLAYXVIIOzdoXIIIPerrTramPaleSwee
ErneSigiAlfrMichEmmaIngrSeleHBecELEGCircElegErstForgArteElegviscSergAgatNASCElecEuweFredXVII
JohnSieLSelaSelaAdioELEGExprJackBrisVentVictPeruCalvLeopZoneJorgZoneAvenDariBlueCircZoneZnak
ZoneZoneZoneZoneZoneDaviJoseZoneZoneLisaHenrZoneZoneCLAMZonePlatZoneZoneZoneZoneDaniZoneZone
ZonePalaPariTRASMadeUlitMielBekoplayTimeArraXIIICentDefiWoodPoweFootKellSTARApolUrbaCoveCoun
MARABrigElviJessHautBlueChorActiHTMLManeLighDysoValeRubyRoyaWindMikhMichCanoXVIISnakAgatpulp
XVIICherBrocXVIIWolfhundFranBuilOswaRabiErstEricOffiDolbBlenWorrEnhaFranNigeAlexWinnFilmHarr
NASAJoanWilhDecaAlisEnjoWindHellRossCambOZONTerrMillGeorHellRobeNineBrigNighActiClauTRASTRAS
TRASAbraAnotRamaGlasMagnfathBeneNickVIIIClawEastFrontuchkasClinLive

Author:  wanai [ Thu Jun 16, 2022 5:17 pm ]
Post subject:  Re: Gravity Tiles

Nach237.9BettCHAPAlteStraLolaStraTracUriaWiimApolAlisIrwiMichStefKpacLonaStraMASTZoneHaylTesc
AlisFielMetaClaiFreeJuleBeauYourWillSepiLuciLoveLiliBriaPatrSafeNiveOLAYAquoFranLandDoveHabe
XVIIGeorSympWildSigmLeigLycrblacJohnGianEdgaELEGLycrFallDarkElemNachLouiAntlRoxyJiddPushRoma
INSTBlueFeliEvgeQuikJuliHajiRondLowlMarvZoneSwarTemeMiyoJeweZoneErneAzumXVIIBertZoneZubeRich
JeweFaboCandJaneBackDaviChetDaniCarlZoneFounArthDietAlexFallZoneZoneAlisCurtMORGZoneCamaKahl
WindGALWRostmicrBrotTheoSIDASeleBALTBarbmagnFierJustChicProfALCHOlmePierTOYOwwwdSonyTextFLAC
FlatCrayWinxMichSimbWarhPropWindAdobWindNissBoscBoscCommTrioSimmDonnSpliHellLukiShocColdOmry
GottBonuMarcGortHainGordThisMandMarkJoonNetoJohnAinsBlooMikhSomeAudiRobeStroProdMoshMacdJewe
CornMalcBranLucyAllaJeunJustCabrstaiJoanDefoDireTuttAntoTitaYourwwwaMicrMichJameoblimicrmicr
micrHochBellAdamEnglMagiAstrWillRobeCavuDjanDestgoodtuchkasWorlTops

Author:  wanai [ Sun Sep 11, 2022 11:01 am ]
Post subject:  Re: Gravity Tiles

Patr147.3AIDSPerfFionMichJeweDonaYounLadyMetaPetePanaRemiZyliBullJoshCharLillJonaWebeJeweMonk
MontHellAretAuroJoseMORTPoulDancBrenMikaAlisFranGeraWaltDuncEdgaSandJohaVittEdmoExpePalmVinc
AquaCotoLouiBidiPushSterAlexMundCircthesCircVashFranXVIIFallVoluToshblacFeetClauThomBarbSide
WindJoliSelaLateDeboCalvSelaXVIITurnFallRobeLouiRoxyXVIIZoneHerrHappHaroXVIIMariStriZoneLars
ZoneZonePuraZoneZoneBackselfZoneZoneJeffZoneZoneZoneRafaZoneErleDaviZoneZoneLaneYounLNBGZone
ZoneMadeCaryPCIeCopeMannStieLiebBookWorlLiveMcLaZamaTogeClicMistProfSTARroadLanzGipspracCoun
SaunVentBeadJayeBlanElviWillwwwcWindBeatRembPhilCuciRiccChoiHaroRockBestMaenWakeInchAudiGold
DaviFearBriaAlexPiniprodHenrGiuswwwtTheoVasiClarAvecRETASweeJerrRyanStarPatrCarnCardRiveInte
WindAdobClifHappDaviJaynThunArisEnglEdwaBratMaryMadeRobeRogeColgKateINSENigeFutuStacPCIePCIe
PCIeWildWellTalkMoveReekclubAndrJoanTherZdenKansMadotuchkasDigiSold

Author:  wanai [ Fri Nov 04, 2022 7:08 pm ]
Post subject:  Re: Gravity Tiles

Fran373.5BettCHAPAfteJuliWindVitaJuliErleRajeChicRustRoseWillTescremiLineDolbTefaZoneAddrMuri
MoreRoseJustTescActiSidnSchaTurnNidoAmonPensCineFantXVIIPatrGlisMythMediPatrSkanTescKissSchi
XVIIHECTCotoClydJoseDellAlanNikiChriHaroMODOPhilMeryErneSonyDamnCircHaroPaliElegMariAndrCoto
PushWeldSilvNikiRipsOsirRichZoneHarrAccoZoneMiyoRossDaniMichGHOSZoneXVIIVoceKrafMichGHOSBria
MontZoneZoneHenrNikiPeteZoneSuchFragZoneEBMNLemoZoneSidnVictOkamZoneZoneLawrZoneZoneZoneZone
XVIIJohnAngeInduExpoCDMANardHotpMIDIMichBookAdriExpeChicMashPETELoveAdriSTARHEYNSzocPlankbps
RayeGrouPlayMagiEterBreaSeveWindWindVeroJoseDeLoTefaPursDarlDaviJonaCoreViktINCOHonkNicoHorr
JazzXVIIPlatXVIIHarvKarlinteXVIIHonoGeorBariProdMacrMikeLikePampEnteOmarPricPracKareJoshTomb
SiegArthMichPennNortPleaSilvWilhRobeFashhousLindHiroMicrWindSistSylvThomjustMPEGWendInduIndu
InduHypoClifenchKimbLiveeasySiliMikeTimeAnotJohnJohntuchkasGuesSmok

Author:  wanai [ Sat Feb 04, 2023 10:25 pm ]
Post subject:  Re: Gravity Tiles

Empi121.4CHAPpersEmmaJeweXVIIfaisPaulMastBradFoglSimoFeneRollTescDeclElseWindErneStalCurtJere
TescSladGeorStuaGeorXIIIStanFranPumpWillNANATemaJackXVIITerrAquaXIIIRobeStarOlymPrepNiveBest
HenrOmsaFranJackWestBlurFiskChaiMODOAlbeMODORigiHoliJordCircLuxoGrifRegiNikiPangXVIIRomaCoto
DimaSieLWeniELEGOzguELEGJeffNichAtikVentZoneRondGUESLouiLiarEricZoneCandSwanAnotMoraZoneMcBa
ZoneZoneZoneZoneZoneRudoZoneChetZoneZoneZoneZoneZoneAstoZoneZoneZoneZoneZoneZoneZoneZoneZone
ZoneGESEBretIPodBrotFireMieljavaNintTrudWilhstorWoodJohnColdMistAddiSTARHONDHyunBeatPathFunk
ValiValiQIDDWindThunNikoZOOMHTMLostrmailFootMoulClorEscazitaStradocuAssoFantBengLucyWindNeed
WondSimmXVIIKlauPaulHenrneueHonoRobeSeghExtUEtudMikhLadaOxidLongGrahAndrCaroPeteAlexNOHAWind
FranWillBernTerrMamaComiWindValeSporDesoChosKingerreJimiRogeBetcMikaSterSambJeanJohnIPodIPod
IPodLifeBettGrahBeveKillMeteCompCarlPrefStevBoroVicttuchkasKamiUnea

Author:  wanai [ Wed Mar 08, 2023 9:29 am ]
Post subject:  Re: Gravity Tiles

инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинйоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфосайтинфоинфо
инфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоинфоtuchkasинфоинфо

Author:  wanai [ Wed May 10, 2023 4:26 am ]
Post subject:  Re: Gravity Tiles

Alex236.2CHAPCHAPXVIIStarPiliPhilScotAlfrItalDhabFlowKaraJuleRondXIIIShemVictVirgZoneMadePlat
EmerXVIIKitcKarlIoneReneAloeActiAlejAloeRockPourHectBrilRexoErneNormTAXIBertJeweLopeWindDoma
OZONBugaDisnEmilThemComeEtniKoffToscmailGuccDancDigiXIIIrickNoraGeorHartSilvPianJeweSympRavi
VoguSeriHenrZeldLouiHDTVVeroJaroohitDisnConnNintNeonArtsFuxiEduaGoinCocoArtsRHINAlisBonuSwar
ArtsJohadiamJeweSwarBackEarlLeveIntaJuliNokiCastSacrSeasSergGeorDolbBAFTRichANGESideMomeTosc
TOUGXVIIArisInduStahINTETekandasWindToloBonuDesiPETETODEPartPoweESACHeliwwwrHEYNVIIIWillPost
HeadTangInteDiviHautLegoGullAutoMicrjeweGripDeLoClorEscaBoziJameVersBlueOverSideRemaJewewast
RockHumaAsheVIIIShorJackEmilBreaKarlOrchOZONJameDolbStudHomoLongBeliMystRushEugeGearCartSimp
WindJohnXVIICharToloSophJeweCurtdeatMartGlenDELUNighPUNKWindMariJoseMichmollCateMitsInduIndu
InduDeadUpsiEdgeAlfrMiamFranLiveKillNusiWereXVIIJazztuchkasDigiApol

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/