![]() |
Gravity Tiles - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49) +---- Thread: Gravity Tiles (/showthread.php?tid=1091) |
Gravity Tiles - Rezeyu - 07-07-2007 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 Under it add: Code: If frmMirage.OptGravity.Value = True Then 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 And right under them add this block of code: Code: ' Apply Gravity 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: Re: Gravity Tiles - Cruzn - 08-07-2007 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)) Code: Call SpawnItemSlot(i, MapItem(GetPlayerMap(Index), i).Num, Ammount, MapItem(GetPlayerMap(Index), i).Dur, GetPlayerMap(Index), GetPlayerX(Index), Yloc) Re: Gravity Tiles - Rezeyu - 08-07-2007 Hah, yeah forgot that, Updating right now, thanks. Re: Gravity Tiles - Rian - 08-07-2007 Props dude. This is a pretty neat tutorial. ![]() Re: Gravity Tiles - William - 11-07-2007 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? Re: Gravity Tiles - Matt - 11-07-2007 Yupp. Could easily make it slide npcs and players. Re: Gravity Tiles - wisefire - 17-07-2007 Change this to work for players and npc and you have yourself a side scrolling rpg. Very Nice indeed. Re: Gravity Tiles - Rezeyu - 17-07-2007 If you wanted it like that you'd do it with a timer. Re: Gravity Tiles - Braydok - 14-08-2007 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.) Re: Gravity Tiles - Rezeyu - 14-08-2007 Psst. Look at the way the client uses the Y offset for NPCs and Players. |