Aldeia RPG

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Suporte ao desenvolvimento de jogos


3 participantes

    Urgente Projectiles

    marccvz
    marccvz
    Novato
    Novato


    Mensagens : 29
    Créditos : 1

    Urgente Projectiles Empty Urgente Projectiles

    Mensagem por marccvz 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
    Terabin
    Terabin
    Iniciante
    Iniciante


    Mensagens : 66
    Créditos : 39

    Urgente Projectiles Empty Re: Urgente Projectiles

    Mensagem por Terabin 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.


    _________________
    Urgente Projectiles P8GSWml
    http://4tabern.com
    marccvz
    marccvz
    Novato
    Novato


    Mensagens : 29
    Créditos : 1

    Urgente Projectiles Empty Re: Urgente Projectiles

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

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


    Mensagens : 82
    Créditos : 2

    Ficha do personagem
    Nível: 1
    Experiência:
    Urgente Projectiles Left_bar_bleue0/0Urgente Projectiles Empty_bar_bleue  (0/0)
    Vida:
    Urgente Projectiles Left_bar_bleue30/30Urgente Projectiles Empty_bar_bleue  (30/30)

    Urgente Projectiles Empty Re: Urgente Projectiles

    Mensagem por Cenourinha404 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
    marccvz
    marccvz
    Novato
    Novato


    Mensagens : 29
    Créditos : 1

    Urgente Projectiles Empty Re: Urgente Projectiles

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

    david ??
    Cenourinha404
    Cenourinha404
    Semi-Experiente
    Semi-Experiente


    Mensagens : 82
    Créditos : 2

    Ficha do personagem
    Nível: 1
    Experiência:
    Urgente Projectiles Left_bar_bleue0/0Urgente Projectiles Empty_bar_bleue  (0/0)
    Vida:
    Urgente Projectiles Left_bar_bleue30/30Urgente Projectiles Empty_bar_bleue  (30/30)

    Urgente Projectiles Empty Re: Urgente Projectiles

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

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


    Mensagens : 29
    Créditos : 1

    Urgente Projectiles Empty Re: Urgente Projectiles

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

    Não resolveu Sad Sad Sad  
    Urgente Projectiles Imagem10

    Conteúdo patrocinado


    Urgente Projectiles Empty Re: Urgente Projectiles

    Mensagem por Conteúdo patrocinado


      Data/hora atual: Qui Mar 28, 2024 1:43 pm