Print Page | Close Window

Sprite change tile

Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=189
Printed Date: 20 December 2006 at 5:53pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Sprite change tile
Posted By: Sync
Subject: Sprite change tile
Date Posted: 11 February 2006 at 3:24pm
this will make a simple sprite changing tile

first add in modtypes in server and client under tile constants

Public Const TILE_TYPE_SPRITE = 9


find in server, modgamelogic, playermove

 
           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


and under it add


 
   '  ///////////////////////
    ' //check 4 sprite tile//
    '///////////////////////
    '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


ok thats all for server


now in client

find                             
If .Type = TILE_TYPE_KEYOPEN Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "O", QBColor(white))



and under it add

If .Type = TILE_TYPE_SPRITE Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "S", QBColor(BrightBlue))



now also find

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


and under it add

                     If frmMirage.optsprite.Value = True Then
                           .Type = TILE_TYPE_SPRITE
                           .Data1 = SpriteNum
                           .Data2 = 0
                           .Data3 = 0
                     End If



now the final bit, adding the the form and radio button
In mapeditor add a radio button called optsprite double click on it and add

   
frmsetsprite.Show vbModal


now make a new form called frmsetsprite

make 2 picboxs called
    picsprite
    picsprites

make 2 command buttons called
    cmdok
    cmdcancel

make a scrlbar called scrlsprites

make a timer called tmrsprite

and two labels one called lblspritenum


ok now add this 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


This was done quickly since I only have 10 mins at libary



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info