Jump to content

Problema con una animacion (SpriteAnim)


Bc#

Recommended Posts

Posted
Cuando usas DirectX, tenes que usar posiciones en "absolute".

Una posicion absolute seria asi: 500, 500, 100, 200

Una en relative seria algo asi: 0.05, 0.8, 0.65, 0.15

Eh probado muchas posisiones y multiples tamaños y aun no consigo nada.

function dxDrawGifImage ( x, y, w, h, path, iEnd, effectSpeed ) 
            local gifElement = createElement ( "dx-gif" ) 
            if ( gifElement ) then 
                setElementData ( 
                    gifElement, 
                    "gifData", 
                    { 
                        x = x, 
                        y = y, 
                        w = w, 
                        h = h, 
                        imgPath = path, 
                        endID = iEnd, 
                        imgID = 1, 
                        speed = effectSpeed, 
                        tick = getTickCount ( ) 
                    } 
                ) 
                return gifElement 
            else 
                return false 
            end 
        end 
          
        addEventHandler ( "onClientRender", root, 
            function ( ) 
                local currentTick = getTickCount ( ) 
                for _, gif in ipairs ( getElementsByType ( "dx-gif" ) ) do 
                    local gifData = getElementData ( gif, "gifData" ) 
                    if ( gifData ) then 
                        if ( currentTick - gifData.tick >= gifData.speed ) then 
                            gifData.tick = currentTick 
                            gifData.imgID = ( gifData.imgID + 1 ) 
                            if gifData.imgID > gifData.endID then 
                                gifData.imgID = 1 
                            end 
                            setElementData ( gif, "gifData", gifData ) 
                        end 
                        dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, string.format(gifData.imgPath,gifData.imgID) ) 
                    end 
                end 
            end 
        ) 
          
   gif = dxDrawGifImage ( 769, 175, 193, 145, "img/logo", 13, "png", 60 ) 

Si puedes ves estoy usando la misma posision que sugeriste en el wiki, pero nisiquiera haci logra aparecer alguna imagen.

Bc Media Clan XPG Foro
mtasa://104.223.20.159:21003

Posted

Subi el recurso en un .zip a mediafire.com y postea el link, asi lo pruebo.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Lo que paso es que alguien modifico mi funcion ( dxDrawGifImage ) y la modifico mal, porque ya no funciona.

function dxDrawGifImage ( x, y, w, h, path, iStart, iType, effectSpeed ) 
    local gifElement = createElement ( "dx-gif" ) 
    if ( gifElement ) then 
        setElementData ( 
            gifElement, 
            "gifData", 
            { 
                x = x, 
                y = y, 
                w = w, 
                h = h, 
                imgPath = path, 
                startID = iStart, 
                imgID = iStart, 
                imgType = iType, 
                speed = effectSpeed, 
                tick = getTickCount ( ) 
            } 
        ) 
        return gifElement 
    else 
        return false 
    end 
end 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local currentTick = getTickCount ( ) 
        for index, gif in ipairs ( getElementsByType ( "dx-gif" ) ) do 
            local gifData = getElementData ( gif, "gifData" ) 
            if ( gifData ) then 
                if ( currentTick - gifData.tick >= gifData.speed ) then 
                    gifData.tick = currentTick 
                    gifData.imgID = ( gifData.imgID + 1 ) 
                    if ( fileExists ( gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) ) then 
                        gifData.imgID = gifData.imgID 
                        setElementData ( gif, "gifData", gifData ) 
                    else 
                        gifData.imgID = gifData.startID 
                        setElementData ( gif, "gifData", gifData ) 
                    end 
                end 
                dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) 
            end 
        end 
    end 
) 
  
gif = dxDrawGifImage ( 769, 175, 193, 145, "img/logo", 1, "png", 60 ) 

Funca perfecto.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Lo que paso es que alguien modifico mi funcion ( dxDrawGifImage ) y la modifico mal, porque ya no funciona.
function dxDrawGifImage ( x, y, w, h, path, iStart, iType, effectSpeed ) 
    local gifElement = createElement ( "dx-gif" ) 
    if ( gifElement ) then 
        setElementData ( 
            gifElement, 
            "gifData", 
            { 
                x = x, 
                y = y, 
                w = w, 
                h = h, 
                imgPath = path, 
                startID = iStart, 
                imgID = iStart, 
                imgType = iType, 
                speed = effectSpeed, 
                tick = getTickCount ( ) 
            } 
        ) 
        return gifElement 
    else 
        return false 
    end 
end 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local currentTick = getTickCount ( ) 
        for index, gif in ipairs ( getElementsByType ( "dx-gif" ) ) do 
            local gifData = getElementData ( gif, "gifData" ) 
            if ( gifData ) then 
                if ( currentTick - gifData.tick >= gifData.speed ) then 
                    gifData.tick = currentTick 
                    gifData.imgID = ( gifData.imgID + 1 ) 
                    if ( fileExists ( gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) ) then 
                        gifData.imgID = gifData.imgID 
                        setElementData ( gif, "gifData", gifData ) 
                    else 
                        gifData.imgID = gifData.startID 
                        setElementData ( gif, "gifData", gifData ) 
                    end 
                end 
                dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, gifData.imgPath .."".. gifData.imgID ..".".. gifData.imgType ) 
            end 
        end 
    end 
) 
  
gif = dxDrawGifImage ( 769, 175, 193, 145, "img/logo", 1, "png", 60 ) 

Funca perfecto.

¿Seguro que ese es el script?

Yo lo probe y nada.

Bc Media Clan XPG Foro
mtasa://104.223.20.159:21003

Posted

Si, lo probe en mi servidor local y funciono.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Ese que poste es el que yo use y funciono.

Capaz que no aparece en tu resolucion, yo uso 1024 * 768.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

intente hacer el mio, tome posiciones de una imagen de test, pero no aparece el gif D:

  
        function dxDrawGifImage ( x, y, w, h, path, iEnd, effectSpeed ) 
            local gifElement = createElement ( "dx-gif" ) 
            if ( gifElement ) then 
                setElementData ( 
                    gifElement, 
                    "gifData", 
                    { 
                        x = x, 
                        y = y, 
                        w = w, 
                        h = h, 
                        imgPath = path, 
                        endID = iEnd, 
                        imgID = 1, 
                        speed = effectSpeed, 
                        tick = getTickCount ( ) 
                    } 
                ) 
                return gifElement 
            else 
                return false 
            end 
        end 
          
        addEventHandler ( "onClientRender", root, 
            function ( ) 
                local currentTick = getTickCount ( ) 
                for _, gif in ipairs ( getElementsByType ( "dx-gif" ) ) do 
                    local gifData = getElementData ( gif, "gifData" ) 
                    if ( gifData ) then 
                        if ( currentTick - gifData.tick >= gifData.speed ) then 
                            gifData.tick = currentTick 
                            gifData.imgID = ( gifData.imgID + 1 ) 
                            if gifData.imgID > gifData.endID then 
                                gifData.imgID = 1 
                            end 
                            setElementData ( gif, "gifData", gifData ) 
                        end 
                        dxDrawImage ( gifData.x, gifData.y, gifData.w, gifData.h, string.format(gifData.imgPath,gifData.imgID) ) 
                    end 
                end 
            end 
        ) 
          
   gif = dxDrawGifImage ( 504, 29, 105, 75, "img/logo", 33, "png", 60 ) 
  

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted

Estas usando la funcion que algun pelo**** edito, copiala de nuevo de la wiki, puse de nuevo la mia original.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
aparece pero se queda en la primera imagen D:

Podrías probar con esto.

   gif = dxDrawGifImage ( 504, 29, 105, 75, "img/logo", 1, "png", 120 ) 

No estoy seguro pero el argumento que tenias en 33 debe estar en 1 o 0 dependiendo de el numero con el que comiese la primera imagen del ciclo.

ejemplo:

si tu primera imagen es logo0 usas:

   gif = dxDrawGifImage ( 504, 29, 105, 75, "img/logo", 0, "png", 120 ) 

y si es logo1 usas:

   gif = dxDrawGifImage ( 504, 29, 105, 75, "img/logo", 0, "png", 120 ) 

y por experiencia propia yo recomiendo usar 120 en el argumento de effectspeed por que sino va muy rápido el gif y no da tiempo de verlo.

PD: Si quieres que funcione usa la funcion del wiki.

Bc Media Clan XPG Foro
mtasa://104.223.20.159:21003

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...