Bc# Posted November 1, 2012 Posted November 1, 2012 Trato de hacer una animacion de un logo pero no logro que me funcione este es mi codigo. function logoanimado() SpriteAnim: new( "logo.png", 0.68, 0, 0.45, 0.355, 5, 5, 30); end addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), logoanimado ) y esta es la imagen: me estoy giando a partir de este post: https://forum.multitheftauto.com/viewtopic.php?f=108&t=49179 Ayuda por favor.
NodZen Posted November 1, 2012 Posted November 1, 2012 Te recomiendo esto: https://wiki.multitheftauto.com/wiki/DxDrawGifImage
Arsilex Posted November 1, 2012 Posted November 1, 2012 te recuerdo que estas funciones solo funcionan si es en el mismo script si cambias de resource ya no funcionan.
Bc# Posted November 1, 2012 Author Posted November 1, 2012 Te recomiendo esto:https://wiki.multitheftauto.com/wiki/DxDrawGifImage Si utilizo esa funcion, ¿Tendría que usar la misma imagen del post?
NodZen Posted November 1, 2012 Posted November 1, 2012 Te recomiendo esto:https://wiki.multitheftauto.com/wiki/DxDrawGifImage Si utilizo esa funcion, ¿Tendría que usar la misma imagen del post? Si. Acuerdate que tiene que ser en secuencia las imagenes. Ejemplo radar_1,radar_2,radar_3.
Arsilex Posted November 1, 2012 Posted November 1, 2012 no si usas esa tienes que tener cada parte del gif en png cada imagen no se si me explico osea la del post que pusiste ariva no sirve.
Bc# Posted November 1, 2012 Author Posted November 1, 2012 No entendi mucho lo de la susesion de imagenes Pero ejemplo este es mi codigo. gif = dxDrawGifImage ( 0.68, 0, 4.5, 3.55, "img/logo%", 0, "png", 60 ) addCommandHandler ( "destroygif", function ( ) destroyElement ( gif ) end ) asi me tendria que leer las imagenes que en su nombre tengan logo seguido de un numero. Ejemplo. logo1, logo2 , logo3, logo4.
Arsilex Posted November 1, 2012 Posted November 1, 2012 ese es el script de la wiki no es tuyo y esta mas lee mejor
Bc# Posted November 1, 2012 Author Posted November 1, 2012 ese es el script de la wiki no es tuyo y esta mas lee mejor Si se que es de la wiki pero esta adecuado para mi proposito, lo que pregunto se es que funcionaria
Bc# Posted November 1, 2012 Author Posted November 1, 2012 creo que tendrías que usar exports Exports ¿?
Bc# Posted November 1, 2012 Author Posted November 1, 2012 Este script estoy usando. gif = dxDrawGifImage ( 0.68, 0, 4.5, 3.55, "img/logo%", 13, "png", 60 ) addCommandHandler ( "destroygif", function ( ) destroyElement ( gif ) end ) pero no se si estara bien el "img/logo%"
Castillo Posted November 1, 2012 Posted November 1, 2012 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 ( 0.68, 0, 4.5, 3.55, "img/logo", 13, "png", 60 )
Bc# Posted November 1, 2012 Author Posted November 1, 2012 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 ( 0.68, 0, 4.5, 3.55, "img/logo", 13, "png", 60 ) Lo probe y no funciona
Arsilex Posted November 1, 2012 Posted November 1, 2012 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 ) local sWidth,sHeight = guiGetScreenSize() gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo.png", 20, 120 ) addCommandHandler ( "destroygif", function ( ) destroyElement ( gif ) end )
Bc# Posted November 1, 2012 Author Posted November 1, 2012 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 ) local sWidth,sHeight = guiGetScreenSize() gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo.png", 20, 120 ) addCommandHandler ( "destroygif", function ( ) destroyElement ( gif ) end ) Tampoco Funciona :C
NodZen Posted November 1, 2012 Posted November 1, 2012 Tenes todos los cuadros del gif? Los agregaste al meta?
Bc# Posted November 1, 2012 Author Posted November 1, 2012 si en total son 13, tambien los agrege al meta
iFoReX Posted November 2, 2012 Posted November 2, 2012 yo use esta funcion una vez ( me dio mucho lagg en mi server ), yo hice esto : 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 ) local sWidth,sHeight = guiGetScreenSize() gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo1.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo2.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo3.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo4.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo5.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo6.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo7.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo8.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo9.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo10.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo11.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo12.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo13.png", 20, 120 )
Castillo Posted November 2, 2012 Posted November 2, 2012 Porque eso que hiciste no tiene sentido, estas creando todas las imagenes como si la funcion no existiese. @Bc: La posicion debe ser absolute.
Bc# Posted November 2, 2012 Author Posted November 2, 2012 yo use esta funcion una vez ( me dio mucho lagg en mi server ), yo hice esto : 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 ) local sWidth,sHeight = guiGetScreenSize() gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo1.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo2.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo3.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo4.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo5.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo6.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo7.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo8.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo9.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo10.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo11.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo12.png", 20, 120 ) gif = dxDrawGifImage (sWidth*0,sHeight*0,sWidth*0.5,sHeight*0.5, "img/logo13.png", 20, 120 ) No anima la imagen creo que eso solo hace que salga una imagen ensima de la otra
Bc# Posted November 2, 2012 Author Posted November 2, 2012 Porque eso que hiciste no tiene sentido, estas creando todas las imagenes como si la funcion no existiese.@Bc: La posicion debe ser absolute. ¿Posision absolute? Bueno yo lo de la posision es lo ultimo que queria ver pero pretendo que la imagen se plasme en la parte superior derecha de la pantalla, ¿Me podrías das un ejemplo?
Castillo Posted November 2, 2012 Posted November 2, 2012 Simplemente consegui la posicion en absolute.
Bc# Posted November 3, 2012 Author Posted November 3, 2012 Simplemente consegui la posicion en absolute. No entiendo a que te refieres con posision en absulute.
Castillo Posted November 3, 2012 Posted November 3, 2012 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
Recommended Posts