01-06-2006, 09:25 PM
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!)
:: SERVER SIDE ::
In modGameLogic, find:Beneath that, add:
:: CLIENT SIDE ::
Find:
Beneath it, add:Find:Beneath it, add:
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:
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:That's all!
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
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))
Code:
If frmMirage.optKeyOpen.Value = True Then
.Type = TILE_TYPE_KEYOPEN
.Data1 = KeyOpenEditorX
.Data2 = KeyOpenEditorY
.Data3 = 0
End If
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:
- picsprite
- picsprites
Make two command buttons called
- cmdok
- cmdcancel
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