Suporte ao desenvolvimento de jogos!


    Urgente Projectiles

    Compartilhe
    avatar
    marccvz
    Novato
    Novato

    Mensagens : 25
    Créditos : 1

    Urgente Projectiles

    Mensagem por marccvz em Qua Mar 29, 2017 12:25 pm

    Ola pessoal do aldeia alguem poderia me ajudar com o sistema de projectiles.
    ele só usa sprites tamanho 32x32 alguem poderia me ajuda a deixa eu que nem o do sprite que pode colocar qualquer tamanho que ele lê obrigado pessoal.


    Código:
    ' player Projectiles
    Public Sub BltProjectile(ByVal Index As Long, ByVal PlayerProjectile As Long)
    Dim x As Long, Y As Long, PicNum As Long, i As Long
    Dim rec As DxVBLib.RECT

        ' If debug mode, handle error then exit out
        If Options.Debug = 1 Then On Error GoTo errorhandler
       
        ' check for subscript error
        If Index < 1 Or PlayerProjectile < 1 Or PlayerProjectile > MAX_PLAYER_PROJECTILES Then Exit Sub
       
        ' check to see if it's time to move the Projectile
        If GetTickCount > Player(Index).ProjecTile(PlayerProjectile).TravelTime Then
            With Player(Index).ProjecTile(PlayerProjectile)
                ' set next travel time and the current position and then set the actual direction based on RMXP arrow tiles.
                Select Case .Direction
                    ' down
                    Case 0
                        .Y = .Y + 1
                        ' check if they reached maxrange
                        If .Y = (GetPlayerY(Index) + .Range) + 1 Then ClearProjectile Index, PlayerProjectile: Exit Sub
                    ' up
                    Case 1
                        .Y = .Y - 1
                        ' check if they reached maxrange
                        If .Y = (GetPlayerY(Index) - .Range) - 1 Then ClearProjectile Index, PlayerProjectile: Exit Sub
                    ' right
                    Case 2
                        .x = .x + 1
                        ' check if they reached max range
                        If .x = (GetPlayerX(Index) + .Range) + 1 Then ClearProjectile Index, PlayerProjectile: Exit Sub
                    ' left
                    Case 3
                        .x = .x - 1
                        ' check if they reached maxrange
                        If .x = (GetPlayerX(Index) - .Range) - 1 Then ClearProjectile Index, PlayerProjectile: Exit Sub
                End Select
                .TravelTime = GetTickCount + .Speed
            End With
        End If
       
        ' set the x, y & pic values for future reference
        x = Player(Index).ProjecTile(PlayerProjectile).x
        Y = Player(Index).ProjecTile(PlayerProjectile).Y
        PicNum = Player(Index).ProjecTile(PlayerProjectile).Pic
       
        ' check if left map
        If x > Map.MaxX Or Y > Map.MaxY Or x < 0 Or Y < 0 Then
            ClearProjectile Index, PlayerProjectile
            Exit Sub
        End If
       
        ' check if we hit a block
        If Map.Tile(x, Y).Type = TILE_TYPE_BLOCKED Then
            ClearProjectile Index, PlayerProjectile
            Exit Sub
        End If
       
        ' check for player hit
        For i = 1 To Player_HighIndex
            If x = GetPlayerX(i) And Y = GetPlayerY(i) Then
                ' they're hit, remove it
                If Not x = Player(MyIndex).x Or Not Y = GetPlayerY(MyIndex) Then
                    ClearProjectile Index, PlayerProjectile
                    Exit Sub
                End If
            End If
        Next
       
        ' check for npc hit
        For i = 1 To MAX_MAP_NPCS
            If x = MapNpc(i).x And Y = MapNpc(i).Y Then
                ' they're hit, remove it
                ClearProjectile Index, PlayerProjectile
                Exit Sub
            End If
        Next
       
        ' if projectile is not loaded, load it, female dog.
        If DDS_Projectile(PicNum) Is Nothing Then
            Call InitDDSurf("projectiles" & PicNum, DDSD_Projectile(PicNum), DDS_Projectile(PicNum))
        End If
       
        ' get positioning in the texture
        With rec
            .top = 0
            .Bottom = SIZE_Y
            .Left = Player(Index).ProjecTile(PlayerProjectile).Direction * SIZE_X
            .Right = .Left + SIZE_X
        End With

        ' blt the projectile
        Call Engine_BltFast(ConvertMapX(x * PIC_X), ConvertMapY(Y * PIC_Y), DDS_Projectile(PicNum), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
       
        ' Error handler
        Exit Sub
    errorhandler:
        HandleError "BltProjectile", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
        Err.Clear
        Exit Sub
    End Sub
    avatar
    Terabin
    Administrador
    Administrador

    Mensagens : 65
    Créditos : 39

    Re: Urgente Projectiles

    Mensagem por Terabin em Qua Mar 29, 2017 3:46 pm

    Provavelmente o DDSD_Projectile(PicNum) ou o DDS_Projectile(PicNum) tem funções ou propriedades que retornam o tamanho (width e height) do sprite.

    Pegue o height, divida por 4 e substitua por todos os PIC_Y na função, faça o mesmo com o width mas substitua os PIC_X ao invés de PIC_Y.


    _________________

    http://4tabern.com
    avatar
    marccvz
    Novato
    Novato

    Mensagens : 25
    Créditos : 1

    Re: Urgente Projectiles

    Mensagem por marccvz em Qua Mar 29, 2017 3:57 pm

    não entendi nada kkkkkkkkkkkk
    avatar
    Cenourinha404
    Semi-Experiente
    Semi-Experiente

    Mensagens : 82
    Créditos : 2

    Ficha do personagem
    Nível: 1
    Vida:
    30/30  (30/30)
    Energia:
    0/0  (0/0)

    Re: Urgente Projectiles

    Mensagem por Cenourinha404 em Qua Mar 29, 2017 5:56 pm

    ' player Projectiles
    Public Sub BltProjectile(ByVal Index As Long, ByVal PlayerProjectile As Long)
    Dim x As Long, Y As Long, PicNum As Long, i As Long
    Dim rec As DxVBLib.RECT

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    ' check for subscript error
    If Index < 1 Or PlayerProjectile < 1 Or PlayerProjectile > MAX_PLAYER_PROJECTILES Then Exit Sub

    ' check to see if it's time to move the Projectile
    If GetTickCount > Player(Index).ProjecTile(PlayerProjectile).TravelTime Then
    With Player(Index).ProjecTile(PlayerProjectile)
    ' set next travel time and the current position and then set the actual direction based on RMXP arrow tiles.
    Select Case .Direction
    ' down
    Case 0
    .Y = .Y + 1
    ' check if they reached maxrange
    If .Y = (GetPlayerY(Index) + .Range) + 1 Then ClearProjectile Index, PlayerProjectile: Exit Sub
    ' up
    Case 1
    .Y = .Y - 1
    ' check if they reached maxrange
    If .Y = (GetPlayerY(Index) - .Range) - 1 Then ClearProjectile Index, PlayerProjectile: Exit Sub
    ' right
    Case 2
    .x = .x + 1
    ' check if they reached max range
    If .x = (GetPlayerX(Index) + .Range) + 1 Then ClearProjectile Index, PlayerProjectile: Exit Sub
    ' left
    Case 3
    .x = .x - 1
    ' check if they reached maxrange
    If .x = (GetPlayerX(Index) - .Range) - 1 Then ClearProjectile Index, PlayerProjectile: Exit Sub
    End Select
    .TravelTime = GetTickCount + .Speed
    End With
    End If

    ' set the x, y & pic values for future reference
    x = Player(Index).ProjecTile(PlayerProjectile).x
    Y = Player(Index).ProjecTile(PlayerProjectile).Y
    PicNum = Player(Index).ProjecTile(PlayerProjectile).Pic

    ' check if left map
    If x > Map.MaxX Or Y > Map.MaxY Or x < 0 Or Y < 0 Then
    ClearProjectile Index, PlayerProjectile
    Exit Sub
    End If

    ' check if we hit a block
    If Map.Tile(x, Y).Type = TILE_TYPE_BLOCKED Then
    ClearProjectile Index, PlayerProjectile
    Exit Sub
    End If

    ' check for player hit
    For i = 1 To Player_HighIndex
    If x = GetPlayerX(i) And Y = GetPlayerY(i) Then
    ' they're hit, remove it
    If Not x = Player(MyIndex).x Or Not Y = GetPlayerY(MyIndex) Then
    ClearProjectile Index, PlayerProjectile
    Exit Sub
    End If
    End If
    Next

    ' check for npc hit
    For i = 1 To MAX_MAP_NPCS
    If x = MapNpc(i).x And Y = MapNpc(i).Y Then
    ' they're hit, remove it
    ClearProjectile Index, PlayerProjectile
    Exit Sub
    End If
    Next

    ' if projectile is not loaded, load it, female dog.
    If DDS_Projectile(PicNum) Is Nothing Then
    Call InitDDSurf("projectiles" & PicNum, DDSD_Projectile(PicNum), DDS_Projectile(PicNum))
    End If

    ' get positioning in the texture
    With rec
    .top = 0
    .Bottom = SIZE_Y
    .Left = Player(Index).ProjecTile(PlayerProjectile).Direction * SIZE_X
    .Right = .Left + SIZE_X
    End With

    ' blt the projectile
    Call Engine_BltFast(ConvertMapX(x * PIC_X), ConvertMapY(Y * PIC_Y), DDS_Projectile(PicNum), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)

    ' Error handler
    Exit Sub
    errorhandler:
    HandleError "BltProjectile", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
    End Sub
    avatar
    marccvz
    Novato
    Novato

    Mensagens : 25
    Créditos : 1

    Re: Urgente Projectiles

    Mensagem por marccvz em Qui Mar 30, 2017 10:14 am

    david ??
    avatar
    Cenourinha404
    Semi-Experiente
    Semi-Experiente

    Mensagens : 82
    Créditos : 2

    Ficha do personagem
    Nível: 1
    Vida:
    30/30  (30/30)
    Energia:
    0/0  (0/0)

    Re: Urgente Projectiles

    Mensagem por Cenourinha404 em Qui Mar 30, 2017 5:14 pm

    Esse codigo permite sprite maior de 32x32
    avatar
    marccvz
    Novato
    Novato

    Mensagens : 25
    Créditos : 1

    Re: Urgente Projectiles

    Mensagem por marccvz em Qui Mar 30, 2017 11:05 pm

    Não resolveu Sad Sad Sad  

    Conteúdo patrocinado

    Re: Urgente Projectiles

    Mensagem por Conteúdo patrocinado


      Data/hora atual: Sab Nov 17, 2018 1:41 am