| Mirage Source http://web.miragesource.net/forums/ |
|
| Change Sprite Attribute http://web.miragesource.net/forums/viewtopic.php?f=210&t=52 |
Page 1 of 1 |
| Author: | Tutorial Bot [ Thu Jun 01, 2006 9:25 pm ] |
| Post subject: | Change Sprite Attribute |
Author: funkynut Difficulty: 1/5 This will make a simple sprite changing attribute. :: SERVER & CLIENT SIDE :: First, in modtypes add: (BE SURE TO DO THIS BOTH CLIENT AND SERVER SIDE!) Code: Public Const TILE_TYPE_SPRITE = 9 :: SERVER SIDE :: In modGameLogic, find: Code: Call SendDataToMap(GetPlayerMap(Index), "MAPKEY" & SEP_CHAR & x & SEP_CHAR & y & SEP_CHAR & 1 & SEP_CHAR & END_CHAR) Call MapMsg(GetPlayerMap(Index), "A door has been unlocked.", White) End If End If Beneath that, add: Code: 'Check for sprite tile and then change the sprite If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Type = TILE_TYPE_SPRITE Then spritenum = Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Data1 Call SetPlayerSprite(Index, spritenum) Call SendPlayerData(Index) End If :: CLIENT SIDE :: Find: Code: If .Type = TILE_TYPE_KEYOPEN Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "O", QBColor(white)) Beneath it, add: Code: If .Type = TILE_TYPE_SPRITE Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "S", QBColor(BrightBlue)) Find: Code: If frmMirage.optKeyOpen.Value = True Then .Type = TILE_TYPE_KEYOPEN .Data1 = KeyOpenEditorX .Data2 = KeyOpenEditorY .Data3 = 0 End If Beneath it, add: Code: If frmMirage.optsprite.Value = True Then .Type = TILE_TYPE_SPRITE .Data1 = SpriteNum .Data2 = 0 .Data3 = 0 End If Now the final bit; adding radio button to the map editor. In the mapeditor, add a radio button and name it optsprite. Double click it and add: Code: frmsetsprite.Show vbModal Now make a new form called frmsetsprite. Make two picture boxes called:
Make two command buttons called
Make a scrollbar called scrlsprites. Make a timer called tmrsprite. Make a label called lblspritenum. Okay, now add this code in your new form: Code: Private Sub cmdcancel_Click() Unload Me End Sub Private Sub cmdspritetile_Click() SpriteNum = scrlsprites.Value Unload Me End Sub Private Sub Form_Load() picsprites.Picture = LoadPicture(App.Path & "\graphics\sprites.bmp") End Sub Private Sub scrlsprites_Change() lblspritenum.Caption = STR(scrlsprites.Value) End Sub Private Sub tmrsprite_Timer() Call BitBlt(frmsetsprite.picsprite.hdc, 0, 0, PIC_X, PIC_Y, frmsetsprite.picsprites.hdc, 3 * PIC_X, frmsetsprite.scrlsprites.Value * PIC_Y, SRCCOPY) End Sub That's all! |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|